I have a full n-ary tree with N nodes. The top node is indexed 0 with all other nodes indexed incrementally from left to right as we decend the tree. The last node has index N-1. For example, a 15 node binary tree would be indexed as follows:
0 1,2 3,4,5,6 7,8,9,10,11,12,13,14 So, my question is, for any full n-ary tree with total nodes N, given an arbitrary node index based on this structure, can I determine the nodes depth in the tree? I don't want to have to create a tree structure and traverse it to determine its depth as the tree may potentially be huge. I am hoping to model this structure on the fly with the availability of an analytical formula, but I am not convinved it is possible? Thanks, Douglas. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.