Thread: Minimum height of a B-Tree

1. Minimum height of a B-Tree

Hi

I know you use the formula Log2(N) to find the minimum height of a tree with N number nodes, but the problem is I don't know how to express Log2 ( that is a little two subscript) in programming language. Any help would be appreicated.

thanks,
FlatLost

2. Originally Posted by FlatLost
Hi

I know you use the formula Log2(N) to find the minimum height of a tree with N number nodes, but the problem is I don't know how to express Log2 ( that is a little two subscript) in programming language. Any help would be appreicated.

thanks,
FlatLost
You calculate as follows:

log2(N) = log(N)/log(2)

Where log2(N) is "log to the base 2"

log(N) and log(2) can be natural log or common log or log to any other base (both the same of course)

Dave

3. Thanks Dave for the help!!

4. >to find the minimum height of a tree with N number nodes
You need to be more specific. Is this a B-Tree (which is a different data structure that has differing height guarantees) or are you just abbreviating for a binary search tree?