# Minimum height of a B-Tree

• 03-31-2004
FlatLost
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
• 03-31-2004
Dave Evans
Quote:

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
• 03-31-2004
FlatLost
Thanks Dave for the help!!
• 04-01-2004
Prelude
>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?