In a BST each node's left subtree has smaller keys and its right subtree larger keys. Inorder traversal gives sorted output; balanced trees (AVL, red-black) keep operations O(log n).
Loading subject content…
Loading subject content…
In a BST each node's left subtree has smaller keys and its right subtree larger keys. Inorder traversal gives sorted output; balanced trees (AVL, red-black) keep operations O(log n).