Question
Asked by:
scoobydo
scoobydo
Rating : No Rating
Questions Asked: 11
Tutorials Posted: 0
 

$1.00 Max Heaps

  • From Mathematics: Algorithms
  • Closed, but you can still post tutorials
  • Due on May. 20, 2009
  • Asked on May 17, 2009 at 6:29:26PM
Q:
1.Given the max heap and assume the all elements are distinct,

a. Mark the location(s) with letter g where the greatest element might reside.

b. Mark the location(s) with letter s where the smallest element might reside.


c. What is the height of the heap?



2.Which of the following are max heaps?
{16, 14, 10, 8, 7, 9, 3, 2, 4, 1}



{29, 23, 17, 15, 6, 5, 4, 3, 2, 1}



{23, 17, 14, 6, 13, 10, 1, 5, 7, 12}




3.Given a heap with 18 nodes,

a. How many leaf nodes are there in the heap?






b. What is the height of heap?



 


   
   
   
   
 
Available Tutorials to this Question
Posted by:
b_h
b_h
Rating (671): A+
Questions Asked: 0
Tutorials Posted: 1188, earned $24,641.40
 

$10.00 Heaps

  • This tutorial was purchased 1 time and hasn't been rated yet.
  • Posted on May 17, 2009 at 7:32:58PM
A:
Preview: ... evel are filled from left to right.<br>2. The heap property: each node is greater than or equal to each of its children<br><br>If the elements are in an array, then to satisfy properties 1 and 2 we must have<br><br>array[n] <= array[2*n]<br> and<br>array[n] <= array[2*n+1]<br><br>1.<br>a. The heap property guarantees that the greatest element is always at the top of the heap. This is the only location whe ...

The full tutorial is about 324 words long .
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty