views:

128

answers:

1

I've been doing a research about the best algorithm to use in creating a binary tree implementation. THe top entry in my list is nested sets. Are there any other alternative or better algorithm??

If possible can you give me a list of top algorithms so that I can research/study it and see if it will fit the system needs.

+2  A: 

Quite simply, it depends on what you are going to use it for.

  • Is it important to do insertions, updates and/or deletes fast?
  • Will you any specific out-of-the-ordinary operations on the tree?
  • How much data will there be in the tree?
  • Do you have to store it in a database or just in memory?

And so on..

For example, using a nested set is not really a good choice if the most important operation is: "given a node, find it's grandfather".

Also, you could leverage the fact that you want a binary tree. The nested set model can be used to describe any tree and doesn't really use the fact that it's binary.

Jakob
Yup, I'm actually looking for list suggetions so that I can study the algorithm and determine the best fit.
Hanseh