rwinston
Oct11-07, 03:41 AM
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:
N=2^L-1
N+1=2^L
log_2{N}=L
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:
N = \sum_{i=1}^L i
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:
N=2^L-1
N+1=2^L
log_2{N}=L
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:
N = \sum_{i=1}^L i
My issue is: given N, how can I solve for L?
Thanks!