###### DSSSB PGT 2021

October 7, 2023###### Operating-Systems

October 7, 2023# Data-Structures

Question 228 |

Given a binary-max heap. The elements are stored in an array as 25, 14, 16, 13, 10, 8, 12. What is the content of the array after two delete operations?

14,13,8,12,10 | |

14,12,13,10,8 | |

14,13,12,8,10 | |

14,13,12,10,8 |

Question 228 Explanation:

Step-1: Initially, the heap structure is

Step-2: We have to perform 2 delete operations.

In max-heap (or) min-heap by default we are deleting root element only.

After 1st delete, the heap structure is

Step-2: We have to perform 2 delete operations.

In max-heap (or) min-heap by default we are deleting root element only.

After 1st delete, the heap structure is

Step-3: After 2nd delete operation, the heap structure is

Correct Answer: C

Question 228 Explanation:

Step-1: Initially, the heap structure is

Step-2: We have to perform 2 delete operations.

In max-heap (or) min-heap by default we are deleting root element only.

After 1st delete, the heap structure is

Step-2: We have to perform 2 delete operations.

In max-heap (or) min-heap by default we are deleting root element only.

After 1st delete, the heap structure is

Step-3: After 2nd delete operation, the heap structure is

Subscribe

Login

0 Comments