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:<br /> N=2^L-1<br />
<br /> N+1=2^L<br />
<br /> log_2{N}=L<br />
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:
<br /> N = \sum_{i=1}^L i<br />
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:<br /> N=2^L-1<br />
<br /> N+1=2^L<br />
<br /> log_2{N}=L<br />
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:
<br /> N = \sum_{i=1}^L i<br />
My issue is: given N, how can I solve for L?
Thanks!
Last edited: