hi this is the problem 6-1 of th CLRS

The procedure BUILD-MAX-HEAP in Section 6.3 can be implemented by
repeatedly using
MAX-HEAP-INSERT to insert the elements into the heap. Consider the
following
implementation:
BUILD-MAX-HEAP'(A)
1 heap-size[A] ← 1
2 for i ← 2 to length[A]
3 do MAX-HEAP-INSERT(A, A[i])
a. Do the procedures BUILD-MAX-HEAP and BUILD-MAX-HEAP' always create
the
same heap when run on the same input array? Prove that they do, or
provide a
counterexample.

 clearly  by both the methods  root  of the tree has to be
maximum .......so they are identicl at root level.........

at next level too they have to contain the next two  maximum
elements .,but there is a possibility of permutation of the two so
that the trees may differ .......

can anyone help me to elliminate the permutaion posiibility or give
some example to prove that they are differnt....

thanks in  advance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to