321-HW4 - t3.Compose(i, t2, t3); b == true; } else { b ==...

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

View Full Document Right Arrow Icon
1. Heaps 2. global_function Boolean Satisfies_Ordering_Property ( ); /*! ensures Satisfies_Ordering_Property = [t satisfies the heap ordering property] !*/ { if(t.Size() > 1) { object Boolean b; object Binary_Tree_Of_Integer t2, t3; object Integer i; t.Decompose(i, t2, t3); if(i > t2[current] and i > t3[current]) { Satisfies_Ordering_Property(t2); Satisfies_Ordering_Property(t3); t2.Compose(i, t2, t3);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t3.Compose(i, t2, t3); b == true; } else { b == false; } t.Compose(i, t2, t3); } return b; } 3. I would decompose recursively checking the sizes of the right and left subtrees until I reached the bottom of the tree while checking to see what the sizes of the subtrees are until the bottom, if the right subtree size returns 1 and the left returns 0 then I would know that the shape is incorrect...
View Full Document

This note was uploaded on 02/27/2012 for the course CSE 321 taught by Professor Bucci during the Winter '11 term at Ohio State.

Ask a homework question - tutors are online