- #1
rwinston
- 36
- 0
Hi
I am currently working through the following issue: I am trying to read an list of values which contains the data points for a binomial lattice. If I have a list of N values that describes a binary tree, and I want to find out how many levels deep L the tree is, I can easily do it via the following method, since at each level, the number of nodes in the tree is 2^N-1:[tex]
N=2^L-1
[/tex]
[tex]
N+1=2^L
[/tex]
[tex]
log_2{N}=L
[/tex]
So the number of nodes increases like: 1, 3, 7, 15, 31...But a binary lattice is different - the number of nodes increases like 1,3,6,10,15...i.e. it is an arithmetic sum:
[tex]
N = \sum_{i=1}^L i
[/tex]
My issue is: given N, how can I solve for L?
Thanks!
I am currently working through the following issue: I am trying to read an list of values which contains the data points for a binomial lattice. If I have a list of N values that describes a binary tree, and I want to find out how many levels deep L the tree is, I can easily do it via the following method, since at each level, the number of nodes in the tree is 2^N-1:[tex]
N=2^L-1
[/tex]
[tex]
N+1=2^L
[/tex]
[tex]
log_2{N}=L
[/tex]
So the number of nodes increases like: 1, 3, 7, 15, 31...But a binary lattice is different - the number of nodes increases like 1,3,6,10,15...i.e. it is an arithmetic sum:
[tex]
N = \sum_{i=1}^L i
[/tex]
My issue is: given N, how can I solve for L?
Thanks!
Last edited: