Binary Search Tree
A binary search tree (BST) is a node-based data structure in which each node has at most two children, and every node's left subtree contains only values less than the node while its right subtree contains only values greater, enabling fast lookup, insertion, and deletion.
15 resources across 2 libraries
Glossary Terms(2)
Binary Search Tree
A binary search tree (BST) is a node-based data structure in which each node has at most two children, and every node's left subtree contains only values less…
Hash Table
A hash table (or hash map) is a data structure that maps keys to values using a hash function to compute an index into an array of buckets, giving average O(1)…
Interview Questions(13)
What is a Binary Search Tree (BST)?
A binary search tree is a binary tree where every node’s left subtree holds smaller keys and its right subtree holds larger keys, enabling search, insertion, a…
What is a Balanced Tree?
A balanced tree is a binary tree structured so the height difference between subtrees at every node stays bounded (typically by a constant like 1), keeping the…
What is a Red-Black Tree?
A red-black tree is a self-balancing binary search tree that colors each node red or black and enforces balancing rules so the longest root-to-leaf path is nev…
What is an AVL Tree?
An AVL tree is a self-balancing binary search tree where the heights of the two child subtrees of any node differ by at most one, and it restores this balance…
What is the Lowest Common Ancestor (LCA) Problem?
The lowest common ancestor problem asks for the deepest node in a tree that has both of two given nodes as descendants, and it is typically solved in O(n) with…
What are Inorder, Preorder, and Postorder Tree Traversals?
Inorder, preorder, and postorder are the three depth-first orders for visiting a binary tree's nodes, differing only in when the current node is visited relati…
What is a Skip List?
A skip list is a probabilistic, layered linked-list structure that keeps elements sorted and adds multiple levels of 'express lane' pointers above the base lis…
What is a Splay Tree?
A splay tree is a self-adjusting binary search tree that moves any node accessed — via search, insert, or delete — to the root using a sequence of rotations ca…
What are Catalan Numbers and Their Applications?
Catalan numbers are a sequence C(n) = (2n choose n) / (n+1), computed recursively as the sum over i from 0 to n-1 of C(i)*C(n-1-i), and they count a surprising…
Red-Black Tree vs AVL Tree: What is the Difference?
A red-black tree is a self-balancing binary search tree that keeps rough balance using color and rotation rules, favoring fast insert and delete, while an AVL…
What is a Treap and How Does It Balance Itself?
A treap is a randomized binary search tree that combines BST ordering on keys with heap ordering on randomly assigned priorities, and the randomness alone keep…
What is a Cartesian Tree and What Is It Used For?
A Cartesian tree is a binary tree built from a sequence of values where an in-order traversal recovers the original sequence order, and simultaneously the tree…
What are Persistent Data Structures?
A persistent data structure preserves every previous version of itself after an update, so old versions remain fully accessible and queryable, typically implem…