Answer
The base case is trivial since is given by the definition of a max heap. Then we have that for any sub tree of size m so that the index of the root is i. The definition of a max heap can be applied recursively on the child's of i (2i and 2i+1) so by transitivity i most be the largest.
No comments:
Post a Comment