Sum of a binary tree
I have a binary tree which leafs have a size of 1, and the parent double in size at each level. I project those nodes on a linear axe (memory space). I need to get the equation that gives the adress of the node with the id of the node. Here is the tree : 7 <- size=8 3 11 <- size=4 1 5 9 13 <- size=2 0 2 4 6 8 10 12 14 <- size=1 The address space with the sizes of the nodes : 1 2 1 4 1 2 1 8 1 2 1 4 1 2 1 So the first results are : f(0) = 0 f(1) = 1 f(2) = 3 f(3) = 4 f(4) = 8 f(5) = 9 f(6) = 11 f(7) = 12 f(8) = 20 What is the formula of this layout ?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.