Commit graph

3 commits

Author SHA1 Message Date
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 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 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