Why not use AVL trees as the de facto data storage structure?

https://app.dataquest.io/c/109/m/580/working-with-binary-search-trees/11/testing-the-implementation

If AVL trees are faster than lists, why not use them as the de facto data structure?

Are AVL trees faster than dictionaries? arrays?

@davidaguilaratx: many data structures exists for various purposes. AVL trees might be good at rebalancing and for fast traversal, but then again it is slow to update and delete. And when you want something to be tied to a symbol or character for reference (i.e. a dictionary or hash table) then dictionaries might do the job better.

Depends on the use case, but generally, hash tables/ dictionaries are fastest (assuming no collisions), followed by AVL trees then arrays.

3 Likes