c++ - What should I choose for an easy to code balanced binary search tree? -
I would like to know which simple BST will be easy to code in C ++, and yet complexity is almost equal to o (Logan).
I have already tried red black tree, but would like an alternative which is less complex for code. I have worked with Traps in the past, but are interested in finding the options that are either better performing or easier to implement.
What are your suggestions?
AVL tree Usually in my experience better performance than traps And they are not difficult to implement.
They work by moving the branches of the tree which is unbalanced after any entry or removal. It guarantees that they will have the right balance so that they can not be "cheated" with strange data.
Traps on the other hand randomly , Which is balanced for large data sets, but you still do not get the right o (logan). Apart from this, you can come in a data set that is involved in a very unbalanced way, and your access time may be close to O (N).
See Wikipedia's page for more information:
Comments
Post a Comment