30 30 votes Which one of the following sequences when stored in an array at locations $A[1], \ldots, A[10]$ forms a max-heap? $23,17,10,6,13,14,1,5,7,12$ $23,17,14,7,13,10,1,5,6,12$ $23,17,14,6,13,10,1,5,7,15$ $23,14,17,1,10,13,16,12,7,5$ Data Structures gatecse-2023 data-structures binary-heap one-mark + – admin 14.0k views answer comment Share Follow Print See all 5 Comments 5 5 Comments reply Genius commented Feb 15, 2023 reply Follow flag B is answer 0 0 replyShare Sabuj__Maity commented Feb 15, 2023 reply Follow flag The correct answer is Option B 0 0 replyShare SarthakShastri commented Dec 12, 2023 reply Follow flag B is the correct Ans 0 0 replyShare Shaik Masthan commented Aug 30, 2024 reply Follow flag https://gateoverflow.in/3587/gate-it-2006-question-44 0 0 replyShare TanayH commented Dec 13, 2025 i edited by TanayH Feb 3 reply Follow flag Make tree for every option and check heap property. Is there any method other than the above mentioned? edit: you dont even need to make a tree with enough practice 0 0 replyShare Please log in or register to add a comment.
17 17 votes Answer: B Shoto answered Feb 15, 2023 Shoto comment Share Follow 0 reply Please log in or register to add a comment.
8 8 votes Option (A) is wrong here because node $14$ comes after node $10$ Option (B) is a correct representation of the max heap. Option (C) is wrong here because node $15$ comes after node $13$. Option (D) is wrong here because node $12$ comes after node $1$. Note: Here we insert the given value one by one and check whether the value at root node $\geq$ to its children as a max heap, also it should be a complete binary tree. The max heap representation of option (B) is as follows: Ref: some max heap insertion questions from the previous year: GATE CSE 2014 Set 2 GATE CSE 2015 Set 3 GATE CSE 1996 GATE CSE 2005 Hira Thakur answered Feb 16, 2023 • edited Feb 16, 2023 by Hira Thakur Hira Thakur comment Share Follow 0 reply Please log in or register to add a comment.
3 3 votes Answer: B Souvik33 answered Mar 30, 2023 Souvik33 comment Share Follow 0 reply Please log in or register to add a comment.