algorithm - Search cost on Tree with ordered nodes -


Context: I am building a Foundation DB, and I am thinking of which key to use first

Assume that we have elements of It is set:

  {AP, AQ, AR, BP, BQ, BR}  

And we want to build a tree from it The way the first character is for the first group, and then the second, to get

  root + ----- + ------ + + + + + AB + - - - + ---- + +---- + ---- + | | | | | | + + + + + + + PQRPQR  

Another possible way is to get the first group of the second letter, and then first, to get:

  root + -------- + -------- + + + + + PQR + + + + + + + + + + + + + + + ABABAB  

Consider the probability distribution of stars, uniform, which leads to the fastest search time? In general, what is the best place to have higher branches at top level or on trees or below places?

The first solution is to select one of the 2 options and then to select one of 3 options. Will lead, while the second will first give one of the three options and then one of the two will theoretically be both almost identical.

Edit: According to your comment, if you have two layers, where The number of options is quite different as 30 and 1000000, then you are advised that you have 30 Let Aeon put on high level and 1000000 people are then low. I believe caching will make the lower level faster in similar cases.


Comments