



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Yes binary heap in part (a) is the same as the binary heap in part (b).
If left arr ==
return;
set max = arr[0]
set max_index=0;
for i>n
if arr[i]> max
set max_index=
set max =arr[i]
print max_index;
find_max_index(arr[],size,index,max_index)
if (index == size)
return max_index;
if(arr[index]>arr[max_index]
max_index=index;
return find_max_index(arr[],size,index+1,max_index)
find_max(arr,int l,int r)
if(left arr ==1)
{
return A[1];
}