What is the advantage of a binary search tree over an array based structure?

1 answer

Answer

1113774

2026-05-03 04:05

+ Follow

In a binary search tree, insertion, deletion and lookup are O(log n) (i.e. fast) when balanced.
With unsorted arrays, insertion and deletion are O(1) (i.e. very fast) but lookup is O(n) (i.e. slow).
With sorted arrays, insertion and deletion are O(n) (i.e. slow) and lookup is O(log n) (i.e. fast).

Binary search trees are good if you do all three operation (insertion, deletion, lookup) often and have enough data to justify the added burden of more complex structures and algorithms.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.