previous | start | next

Binary Search Tree vs Arrays

The BinarySearchST implementation uses a sorted array of keys which has the advantage of making searches fast - order log(N).

The disadvantage of this array implementation is with insertions.

A binary search tree implementation uses linked nodes, but attempts to retain the advantages of the array implementation while overcoming the disadvantage.

A binary search tree imitates the fast searching possible using binary search in an array by beginning at the root whose key is a value in the "middle".

At the same time, insertion in a binary search tree avoids the disadvantage of having to move other keys as in the array implementation.



previous | start | next