Closed Kaisle closed 6 years ago
When removing, the test for equality should use the comparator. This allows you to use objects as keys.
Example:
const t = new Tree(function(a,b){return a.c < b.c;}); t.insert({c: 1, d: 2}); t.remove({c: 1, d: 2}); console.log(t.keys()); // prints [ { c: 1, d: 2 } ], should print []
Thanks a lot!
When removing, the test for equality should use the comparator. This allows you to use objects as keys.
Example:
const t = new Tree(function(a,b){return a.c < b.c;}); t.insert({c: 1, d: 2}); t.remove({c: 1, d: 2}); console.log(t.keys()); // prints [ { c: 1, d: 2 } ], should print []