A complete binary tree with a height of 5 has 31 nodes. How many nodes does a binary tree with a height of 97 have? Please do not round or use scientific notation.
Please submit the answer in numerical form WITHOUT commas.
A complete binary tree with a height of 5 has 31 nodes. How many nodes does a binary tree with a height of 97 have? Please do not round or use scientific notation.
Please submit the answer in numerical form WITHOUT commas.
Sort by: Date Rating Last Activity
Comments by IntenseDebate
Posting anonymously.
Vinson · 642 weeks ago
2^97 - 1 =158456325028528675187087900672
Vinson · 642 weeks ago
2^97 - 1 = 158456325028528675187087900671
Cassiel · 642 weeks ago
Dan · 642 weeks ago
McNegro · 642 weeks ago
Amy · 642 weeks ago
Sharon · 642 weeks ago
But I think the formula for calculating the nodes is wrong, is the formula not n = (2^h +1 ) - 1 ??
When used that formula I couldn't get to 31 nodes when inserting height (h) = 5 so I used the one mentioned by Vinson..
SlightlyToasted · 642 weeks ago
MP 1171 · 642 weeks ago
http://www.facebook.com/neopestes
New page with answers!
Nia · 642 weeks ago
spinnercat · 642 weeks ago
Here's my code in JAVA that I used (since no calculator would have that precision), if anyone wants to check:
import java.math.BigInteger;
public class Neopets {
public static void main(String[] args){
BigInteger integer = new BigInteger("1");
for(int i=0;i<97;i++){
integer = integer.multiply(new BigInteger("2"));
}
System.out.println(integer.subtract(new BigInteger("1")));
}
}
Jiggyface · 642 weeks ago
Juli · 641 weeks ago
^
whats the answer in word form?