Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are AVL Trees Evil? [closed]

Tags:

I was reading the article from Steve Yegge about singletons. In it he mentions his teacher told him AVL Trees were evil. Is it just that red and black trees are a better solution?

like image 401
Chap Avatar asked Sep 08 '09 15:09

Chap


People also ask

What are the drawbacks of AVL trees?

Disadvantages of AVL Trees In addition, AVL trees have high constant factors for some operations. For example, restructuring is an expensive operation, and an AVL tree may have to re-balance itself log 2 n \log_2 n log2​n in the worst case during a removal of a node.

Are AVL trees hard?

If you need a write-once–read-many map, AVL trees are hard to beat.

Why do you like red black trees over AVL trees?

Red black is more efficient.

What are the advantages of AVL trees?

Advantages of AVL TreesThe height of the AVL tree is always balanced. The height never grows beyond log N, where N is the total number of nodes in the tree. It gives better search time complexity when compared to simple Binary Search trees. AVL trees have self-balancing capabilities.


2 Answers

Evil from what point of view?

Like always: there are no bad tools, only bad craftsmen.

In my memory, AVL trees have slower insertion/removal but faster retrieval than Red/black. Mainly because of the balance algorithm.

like image 118
Antoine Claval Avatar answered Nov 11 '22 13:11

Antoine Claval


No, AVL trees are certainly not evil in any respect. They are a completely valid self balancing tree structure. They have different performance characteristics than Red-Black trees certainly and typically these differences lead to people choosing a red-black tree over an AVL tree. But this does not make them evil.

like image 21
JaredPar Avatar answered Nov 11 '22 13:11

JaredPar