An AVLTree is a self-balancing binary search tree where the difference in heights between left and right subtrees is at most one, ensuring O(log n) time complexity for search, insertion, and deletion operations.
import { AVLTree } from "collection-kit";
import { AVLTree } from "collection-kit";
const tree = new AVLTree();
tree.insert(10);
tree.insert(20);
tree.insert(5);
tree.insert(15);
console.log("Search 15:", tree.search(15)); // true
tree.remove(20);
console.log("Search 20:", tree.search(20)); // false