Skip to Main Content
Data Structures Using C, 2nd Edition by Pearson
book

Data Structures Using C, 2nd Edition by Pearson

by A. K. Sharma
May 2024
Intermediate to advanced content levelIntermediate to advanced
521 pages
14h 12m
English
Pearson India
Content preview from Data Structures Using C, 2nd Edition by Pearson
340 Data Structures Using C
if (heap[J] > heap[J+1])
pos = J;
else
pos = J+1;
if (heap [pos] > heap[I])
{
temp = heap[pos];
heap [pos]= heap [I];
heap [I] = temp;
I =pos;
}
else
Flag = 0;
}
else
Flag=0;
}
return val;
}
The above program was tested on the heap trees given in Figure 7.37. The input provided is given
below:
Heap1: 67 31 34 8 10 5
Heap2: 22 12 17 4 9 615
e output obtained is given below:
e heap aer merge is …67 31 34 17 12 6 22 8 15 10 9 5 4
It is le for the reader to verify the output from Figure 7.37.
Note: Both MaxHeap and MinHeap ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Structures Using C

Data Structures Using C

Samir Kumar Bandyopadhyay, Kashi Nath Dey
Intermediate C Programming, 2nd Edition

Intermediate C Programming, 2nd Edition

Yung-Hsiang Lu, George K. Thiruvathukal

Publisher Resources

ISBN: 9781299831582