Proving the Number of Nodes in a Full Binary Tree

  • Thread starter Thread starter NuPowerbook
  • Start date Start date
  • Tags Tags
    Binary Tree
AI Thread Summary
To prove that a full binary tree with N≥1 leaves has 2N-1 nodes, the approach involves mathematical induction. The base case is established with P(1), where a single node equals one leaf, confirming the formula. Assuming P(k) holds true, the proof shows that adding one leaf (to make k+1) requires adding two nodes, leading to P(k+1) = 2k + 1. This confirms the inductive step, completing the proof. The definitions of full and complete binary trees were clarified, but the argument remains valid for both types.
NuPowerbook
Messages
8
Reaction score
0
I need to prove that for any full binary tree with N\geq1 leaves, that it has 2N-1 nodes. I can see this when looking at a tree, but I can't figure out how to prove this.
 
Physics news on Phys.org
I'll take a stab at it.

I would try proving by induction on N by letting P(N) be the statement that for a full binary tree with N\geq1 leaves, it has 2N-1 nodes.


starting with the simplest case (a tree consisting of a single node) we'll prove P(1).
in this case #leaves = #nodes = 1.
hence P(1) = 2(1) - 1 and P(1) is a true statement.

now let's assume that P(k) is true for some integer k, where k is greater than or equal to 1.
If we can show that P(k) implies P(k+1) then were done with the proof.

What we want to prove: P(k+1) = 2(k+1) - 1 = 2k + 1

Proof: ( I'll use the notation FBT for "full binary tree" )

a FBT with k+1 leaves has the same number of nodes of a FBT with k leaves + 2.
( notice that you can't add just one node to a FBT for it to remain full )

therefore
P(k+1) = P(k) + 2
P(k+1) = (2k-1) + 2 <---- ( here we used the assumption that P(k) is true )
P(k+1) = 2k + 1

QED


EDIT: I looked up the definitions of both full and complete binary trees online, and realize that they are a little different, however the same argument applies. I went ahead and edited out the word "complete" and changed it to "full".
 
Last edited:
Thank you for the help.
 
Thread 'Voltmeter readings for this circuit with switches'
TL;DR Summary: I would like to know the voltmeter readings on the two resistors separately in the picture in the following cases , When one of the keys is closed When both of them are opened (Knowing that the battery has negligible internal resistance) My thoughts for the first case , one of them must be 12 volt while the other is 0 The second case we'll I think both voltmeter readings should be 12 volt since they are both parallel to the battery and they involve the key within what the...
Thread 'Trying to understand the logic behind adding vectors with an angle between them'
My initial calculation was to subtract V1 from V2 to show that from the perspective of the second aircraft the first one is -300km/h. So i checked with ChatGPT and it said I cant just subtract them because I have an angle between them. So I dont understand the reasoning of it. Like why should a velocity be dependent on an angle? I was thinking about how it would look like if the planes where parallel to each other, and then how it look like if one is turning away and I dont see it. Since...
Back
Top