Editing Tree/Proof of properties of trees

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 21: Line 21:
 
''Proof 2'': It is not difficult to devise an algorithm to generate a planar embedding of a tree. The details are left as an exercise to the reader.<br/>
 
''Proof 2'': It is not difficult to devise an algorithm to generate a planar embedding of a tree. The details are left as an exercise to the reader.<br/>
 
<div align="right"><math>_\blacksquare</math></div>
 
<div align="right"><math>_\blacksquare</math></div>
 
''Theorem'': In a binary tree with external path length <math>E</math>, internal path length <math>I</math>, and <math>N</math> nodes, <math>E = I + 2N</math>. (Caution: the statement <math>E = I + kN</math> for <math>k</math>-ary trees is ''not'', in general, true.)
 
 
''Proof'': By induction. For a tree with one node, we have <math>I = 0</math>, <math>N = 1</math>, and <math>E = 2</math>, since the root potentially has two children, each at depth 1. Thus, <math>E = I + 2N</math>, as expected. Now, assume that <math>E = I + 2(N-1)</math> for all binary trees of <math>N-1</math> vertices, where <math>N \geq 2</math>. Then, consider a binary tree <math>T</math> of <math>N</math> vertices. Choose a leaf of this tree and suppose it is at depth <math>d</math>. Remove this from <math>T</math> to give the tree <math>T'</math> with <math>N-1</math> vertices, internal path length <math>I'</math>, external path length <math>E'</math>, and <math>N-1</math> nodes. The removal of the leaf node of depth <math>d</math> decreases the internal path length by <math>d</math>, so <math>I' = I - d</math>. It also removes two external nodes of depth <math>d+1</math>, which decreases the external path length by <math>2(d+1)</math>. But it introduces an external node of depth <math>d</math> (where the leaf formerly was), which increases the external path length by <math>d</math>, so <math>E' = E - 2(d+1) + d = E - d - 2</math>. By the inductive hypothesis, <math>E' = I' + 2(N-1)</math>. Therefore <math>E - d - 2 = I - d + 2N - 2</math>, so <math>E = I+2N</math>.<div align="right"><math>_\blacksquare</math></div>
 

Please note that all contributions to PEGWiki are considered to be released under the Attribution 3.0 Unported (see PEGWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)