A RedBlackTree is a balanced binary search tree with an additional property that ensures the tree remains balanced during insertions and deletions, providing O(log n) time complexity for these operations.
import { RedBlackTree } from "collection-kit";
import { RedBlackTree } from "collection-kit";
const tree = new RedBlackTree();
tree.insert(10);
tree.insert(20);
tree.insert(5);
console.log("Search 20:", tree.search(20)); // true
tree.remove(10);
console.log("Search 10:", tree.search(10)); // false