1 1 vote A priority queue is implemented as a $Max$-$heap.$Initially, it has $5$ elements. The level order traversal of the heap is $10,8,5,3,2.$ Two new elements $1$ and $7$ are inserted into the heap in that order. The level order traversal of the heap after the insertion of the elements is $10,8,7,5,3,2,1$ $10,8,7,2,3,1,5$ $10,8,7,1,2,3,5$ $10,8,7,3,2,1,5$ Data Structures isrodec2017 data-structures binary-heap priority-queue + – gatecse 2.2k views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply srivivek95 commented Dec 20, 2017 reply Follow flag Resulting Max-heap after insertion of 1 & 7 Level-order traversal : 10 8 7 3 2 1 5 Option (d) 2 2 replyShare pawan kumarln commented Feb 12, 2018 reply Follow flag https://gateoverflow.in/1967/gate2014-2-12 0 0 replyShare Please log in or register to add a comment.
4 4 votes 10 level 0 8 5 level1 3 2 level 2 after insertion of... 10 level 0 8 5 level1 3 2 1 level 2 heap property is still satisfied... then we will insert next 7 10 level 0 8 5 level1 3 2 1 7 level 2 here 5<7 then swap 7 & 5.... 10 level 0 8 7 level1 3 2 1 5 level 2 ..... now traverse...10,8,7,3,2,1,5 hs_yadav answered Dec 20, 2017 hs_yadav comment Share Follow 0 reply Please log in or register to add a comment.