hello,I should make the following draft in java:
I have a generic data sequence and I have to calculate the minimum height of a tree that allows me to obtain the initial sequence reversed, through observation pre-order..
the type of tree is not specified.
how can I do?
thanks and sorry for my bad English:p
Minimum Tree height ?
Started by Jstar, Nov 26 2009 12:10 PM
3 replies to this topic
#1
Posted 26 November 2009 - 12:10 PM
|
|
|
#2
Posted 26 November 2009 - 01:05 PM
If your trying to find the height of a tree transverse it anyway you want recursively keeping track of how high you are in the tree, get the highest number and that's the height of your tree. Or the "smallest" number in your case.
#3
Posted 27 November 2009 - 01:11 AM
the minimum height should be the height of a binary tree, and it is log2 (n + 1) - 1
it is correct?
it is correct?
#4
Posted 27 November 2009 - 06:27 AM
Actually, it would be roundup(log2(n+1))


Sign In
Create Account

Back to top










