Commit graph

209 commits

Author SHA1 Message Date
Revone 1a1ea21444 fix: Adjust type safety for the map method of all binary trees, ensuring it no longer returns the TREE type to its parent class and limiting Node type nesting to a maximum of 10 levels. Fix the issue with RedBlackTree objects being incorrectly compared when used as keys. Rename extractComparable to specificComparable. Correct the order of key and value in callback functions for the map and filter methods. 2024-11-25 01:10:33 +13:00
Revone 1494ffa84f docs: more example code for RedBlackTree and BinarySearchTree 2024-11-24 17:37:33 +13:00
Revone 4298ac658b feat: Add a rangeSearch method to binary search tree data structures and support tuple parameters as the query range. 2024-11-23 22:49:36 +13:00
Revone ca7e60e465 fix: rename the keyValueNodeEntryRawToNodeAndValue to _keyValueNodeEntryRawToNodeAndValue and make it protected 2024-11-22 22:55:43 +13:00
Revone aab0c87da0 docs: add example code for Trie 2024-11-22 19:53:32 +13:00
Revone c3122e7fc7 fix: Type safety fixes for ComparableObject.
feat: Use extractComparable in the BST data structure to control key comparisons instead of directly passing a comparator. Use isReverse to control whether the tree is reversed instead of relying on the comparator.
Removed the unnecessary getNodeByKey method.chore: Support list configuration for performance testing.
2024-11-22 17:12:06 +13:00
Revone 080a671de1 feat: add range search functionality to BST 2024-11-22 11:23:57 +13:00
Revone 713b145a1c feat: Add a highly generic search method to binary tree data structures. Adjust the parameter order for the getPathToRoot method. Add example code to the BST documentation. Rename the get method in DoublyLinkedList and SinglyLinkedList to search. 2024-11-21 19:02:19 +13:00
Revone 09a5d8a11a feat: Enhanced DoublyLinkedList methods to support Node type parameters for push, unshift, addAfter, addBefore, getNode, addAt, delete, indexOf, and getBackward; added a new get method. 2024-11-20 20:43:22 +13:00
Revone f84518cc6d fix: Fixed a bug in the DoublyLinkedList.delete method. Improved the feature for generating sample code documentation for test cases. Added classic example code for Heap and DoublyLinkedList. 2024-11-20 16:27:37 +13:00
Revone 0ff5ddc410 chore: Implement unit tests as example code in the README.md and source code comments. 2024-11-19 23:20:25 +13:00
Revone 476395ef72 chore: Add source map support for ESModule. Add a 'browser' field to package.json. Performance optimization of getRandomIntArray method 2024-11-16 23:07:53 +13:00
Revone 5adf75f99c fix: Fix the bug where the binary tree repeatedly adds elements with the same key in map mode and the bug where the node’s value is instantiated simultaneously. Enable map mode by default. 2024-11-03 16:38:07 +13:00
Revone 28ff30ea4b feat: The binary trees support storing values in a Map and provides parameters for Map mode. #111. Rename type definitions and parameter names to align with best practices. 2024-11-01 19:40:19 +13:00
Revone 6ef4b47b0b docs: Complete the documentation for the print method in BinaryTree. Correct the unit tests for the print method. 2024-10-31 16:44:01 +13:00
Revone 9ace395564 fix: Fix bug in BinaryTree.print to support undefined, null, and NIL. Fix #106 2024-10-31 16:18:51 +13:00
Revone 6428e0f228 fix: Bug fix #103: Fixed an issue where all binary tree clone methods lost constructor parameters. Optimized variable names. Standardized access modifiers for binary tree member variables. 2024-10-30 20:52:23 +13:00
Revone fc0d157295 refactor: Test coverage increased to 95.63%.
Upgraded all dependencies.
Added a toVisual method while retaining the print method.
Replaced all short-circuit evaluations with logical expressions.
2024-10-30 15:30:28 +13:00
Revone aece11bd01 release: v1.52.6 2024-10-29 17:27:40 +13:00
Revone a29dc270e6 Change the print method to return a value instead of directly calling console.log.Unify the logic of all keyValueOrEntryOrRawElementToNode methods in BinaryTree.
Use a generic isComparable method to determine if a value is comparable in size when using the isKey method in the BinaryTree.
Fix the boundary value bug in the getNodes method of BinaryTree.
Support callback functions in getLeftMost and getRightMost to support returning results with different properties.
If a comparator is specified for BST, the isKey method will force the object type to be comparable.
The isComparable method has been implemented based on JavaScript's comparison principles.
2024-10-29 16:23:24 +13:00
Revone e271f73de0 feat: Refactor the BinaryTree's dfs method into a private helper function _dfs to prepare for a more generic implementation. 2024-10-21 19:14:36 +13:00
Revone a699b097c7 feat: The leaves method of the binary tree supports both RECURSIVE and ITERATIVE modes. 2024-10-20 16:59:01 +13:00
Revone 85b79ff1ad feat: All binary tree data structures support the leaves method. It is used to find all leaf nodes. 2024-10-20 15:40:02 +13:00
Revone ea0d4272df fix: Fix #100 the return type error in the find method's callback function in IterableEntryBase.
Add test cases for HashMap and Stack.
2024-10-19 19:51:49 +13:00
Revone 07dd75de70 test: The test cases have been added, though slightly tricky. The overall test coverage is currently at 93.27%. 2024-10-16 21:55:48 +13:00
June Park 59cf685395 fix(trie): trie returns invalid string when only the fist character matches, and the second doesn't match 2024-09-03 00:49:53 +09:00
Revone 7e45aaf609 style: Prettier version updated. Code style adhered to Prettier strictly. 2024-08-27 10:56:04 +12:00
Revone ac1712ba04 feat: supports compact method to save memory. #91 2024-08-27 10:24:38 +12:00
Revone 3e91a97987 fix: #89. Supports maxLen for max length of the Deque 2024-08-04 19:19:14 +12:00
Revone 7f32fee19a docs: Added a document detailing the differences between various data structures, including schematic diagrams of the data structures. 2024-07-31 14:10:32 +12:00
Revone 5dc132cb2a fix: #86 2024-03-16 09:59:48 +08:00
Revone 1ae9e929b1 feat: Provide the toElementFn method during instantiation for the entire data structure series, allowing the mapping of raw data to the desired data type and direct insertion of data into the data structure to be completed within a single loop.
fix: Override the corresponding clone, filter, and map methods in the Heap and PriorityQueue data structures, ensuring the accurate return of the respective data structures. #84 fixed.
2024-02-01 21:05:10 +08:00
Revone 6539e50598 feat: Provide custom toElementFn in Heap configuration options to transform user raw data into a specified element type within a single loop. 2024-01-31 10:04:21 +08:00
Revone 8051850331 feat: When comparing two values in the Heap and binary search tree, if one of the values is of object type, it is mandatory to pass a custom comparator function. 2024-01-29 20:23:06 +08:00
Revone 02d71a23ba Refactor: All binary tree data structures now support the toEntryFn for extracting key and value from raw data at once, avoiding users from having to traverse data multiple times, thus improving performance. Chore: Explicitly use the override keyword. 2024-01-26 18:20:15 +08:00
Revone 0013242189 Refactor: In the binary search tree data structure, use a comparator instead of a variant configuration for comparison. 2024-01-25 10:24:25 +08:00
Revone 89dadfccc2 Refactor: Remove the unnecessary design of the extractor in the Binary Search Tree (BST). Utilize 1, -1, and 0 to replace the original comparison results GT, LT, and EQ. 2024-01-25 09:38:03 +08:00
Revone 1303aba070 refactor: Use Comparable type constraint for the key in the binary tree to improve comparator performance. 2024-01-24 18:38:34 +08:00
Revone 25e9f36577 feat: Remove the meaningless Tree data structure.
refactor: Adjust the logic of isRealNode for a slight performance improvement.
docs: table fixed
2024-01-16 11:26:43 +08:00
Revone 56f1fabfca refactor: Renaming SENTINEL to NIL and placing the NIL node in the BinaryTree allows for direct equality checks in isNIL and isRealNode, avoiding excessive operations to improve performance. As a result, the performance of the get method in AVLTree has tripled. 2024-01-15 21:05:42 +08:00
Revone 9915ce9a0d Refactor: Rename _defaultOneParamCallback to _DEFAULT_CALLBACK. Adopt early return code style in the ensureNode method. Rename some internal recursive method names. 2024-01-15 12:12:01 +08:00
Revone 76df347da5 efactor: completely eliminate the use of enumerations 2024-01-14 19:49:50 +08:00
Revone a11c104dff refactor: Replace all enumerations with union types for significant performance improvements in BST, AVLTree, and RedBlackTree. 2024-01-14 03:04:07 +08:00
Revone a653d465fa Refactor: Use 'this.isRealNode' instead of explicit null checks in getHeight, getMinHeight, and getNodeByKey methods in the binary tree. In the red-black tree, directly invoke the parent class getNode method, significantly improving the speed of red-black tree node deletion and retrieval. 2024-01-12 14:15:05 +08:00
Revone 644ce69190 Refactor: Review methods in the binary tree that require explicit 'override' annotation. Feat: Add the 'getMutableCount' method to AVLMultiMap. 2024-01-12 11:28:15 +08:00
Revone 1f8fc1487c Refactor: Due to critical issues in the previous implementation of the Red-Black Tree, it has been deprecated and replaced with a new implementation of both the Red-Black Tree and TreeMultiMap. 2024-01-11 20:13:02 +08:00
Revone 4747839d88 Refactor: Standardize addition and removal methods for all sequential data structures to push, pop, shift, unshift. 2024-01-09 12:04:50 +08:00
Revone 465744c2ec feat: Replace the AVLTree with a Red-Black Tree to implement TreeMultiMap, preserving the implementation of TreeMultiMap using AVLTree and renaming it as AVLTreeMultiMap. 2024-01-08 22:22:41 +08:00
Revone a95567b3c4 release: 1.50.3 2024-01-07 22:32:39 +08:00
Revone 5c9f4fd483 fix: #74 . Refactor: Implement the Tarjan algorithm separately for DirectedGraph and UndirectedGraph. In the previous design, the tarjan method was placed in the AbstractGraph class. However, Tarjan algorithm is used to find connected components in directed graphs and to solve bridges, articulation points, determine the presence of cycles (though not all), and biconnected components in undirected graphs. The algorithm for finding all cycles in the graph can be shared between directed and undirected graphs using the getCycles method. 2024-01-07 22:25:25 +08:00