{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

2c03-review - 00009

# 2c03-review - 00009 - 1 is not full so T 2 is full and...

This preview shows page 1. Sign up to view the full content.

3 8 T 1 inorder(T 1 )=1,4,9 T 2 inorder(T 2 )= 6,2,5,3,7,8 always full, and that height(T 1 )=height(T)-1, height(T 2 ) height(T)-1. Note also that if T 1 is not full than height(T 2 )=height(T)-2. Thus, in this case we have, height(T 1 )=3-1=2. If T 1 is full then the height 2 implies T 1 has 4 leafs at the bottom level. Since T is complete that it is full if we cut all the leaves at the bottom level. The total number of nodes is number-of- leaves-at-the-bottom-level + (2 h -1), so if T 1 has 4 leafs at the bottom level, then this number is greater or equal to 4+2 3 -1=11>9, which means that T
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 is not full, so T 2 is full and height(T 2 )=height(T)-2=3-2=1, which T 2 has exactly 3 elements. Thus the last 3 elements of our inorder are the inorder of the full tree, the 4 th element from the right is the root of T, the elements on the left of the root of T are the inorder of T 2 which is a complete tree. Hence: Since T 1 is full then one may easy find out that ROOT(T 1 )= 4, LEFT(ROOT(T 1 ))=1, RIGHT(ROOT(T 1 ))=9. For T 2 we repeat the same reasoning as for T. Finally out three T is:...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern