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.
发布评论
评论(6)
从什么角度看恶呢?
一如既往:没有不好的工具,只有不好的工匠。
在我的记忆中,AVL 树的插入/删除速度较慢,但检索速度比红/黑树快。主要是因为平衡算法。
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.
不,AVL 树在任何方面都不是邪恶的。它们是完全有效的自平衡树结构。它们当然具有与红黑树不同的性能特征,并且通常这些差异导致人们选择红黑树而不是 AVL 树。但这并不意味着他们是邪恶的。
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.
我确信 AVL 树是邪恶的,就像 GOTO 是邪恶的或 BUBBLE SORT 是邪恶的一样。
算法并不邪恶,但算法也不会上下跳来告诉你它们何时合适。
I'm sure that AVL trees are evil in the same way that GOTO is evil or BUBBLE SORT is evil.
Algorithms aren't evil, but algorithms also don't jump up and down to tell you when they are appropriate either.
以下是有关红黑树和 AVL 树之间差异的大量信息:
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=22948
和一篇比较不同结构的论文:
http://www.stanford.edu/~blp/papers/libavl.pdf
简而言之 - AVL 搜索速度更快,红黑插入速度更快。
Here's a lot of info about the differences between Red-Black and AVL-Trees:
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=22948
and a paper comparing the different structures:
http://www.stanford.edu/~blp/papers/libavl.pdf
In short - AVL is faster to search, Red-Black faster to insert.
Splay Trees 酷得多。 :)
Splay Trees are much cooler. :)
不,它们并不邪恶,只是编程起来有点棘手。
AVL树
http://www.eternallyconfuzzled.com/tuts/datastructs/jsw_tut_avl.aspx
红黑树链接也从那里开始。
No, they aren't evil, only a bit tricky to program.
AVL Trees
http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_avl.aspx
Red Black tree link from there too.