Binary search tree

medium

One comparison discards an entire subtree - binary search expressed in pointers. Then insert sorted keys and watch it degenerate into a linked list, which is why balanced trees exist.

Best O(log n)Average O(log n)Worst O(n)Space O(n)
Loading the binary search tree engine…

Where to go next