GATE Exam  >  GATE Questions  >  Initially a priority queue had 5 elements and... Start Learning for Free
Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:
  • a)
    30, 18, 19, 12, 11, 10, 17
  • b)
    30, 19, 18, 12, 11, 17, 10
  • c)
    30, 18, 17, 12, 11, 10, 19
  • d)
     30, 18, 19, 12, 11, 17, 10
Correct answer is option 'A'. Can you explain this answer?
Verified Answer
Initially a priority queue had 5 elements and it is being implemented ...
So, the insertion is followed in the same order, hence, we will insert 10 first which doesn’t effect the tree. Now, we insert 19. After insertion of 19 max_heapify founds an error in the node 17 → 11, 17 → 19. So, 19 is send up and 17 is brought down. After that the level order traversal changes to 30, 18, 19, 12, 11, 10, 17
View all questions of this test
Most Upvoted Answer
Initially a priority queue had 5 elements and it is being implemented ...
's denote the elements as A, B, C, D, E. The heap representation would be:

A
/ \
B C
/ \
D E

In a Max-Heap, the parent node is always greater than or equal to its child nodes.
Explore Courses for GATE exam
Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:a)30, 18, 19, 12, 11, 10, 17b)30, 19, 18, 12, 11, 17, 10c)30, 18, 17, 12, 11, 10, 19d)30, 18, 19, 12, 11, 17, 10Correct answer is option 'A'. Can you explain this answer?
Question Description
Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:a)30, 18, 19, 12, 11, 10, 17b)30, 19, 18, 12, 11, 17, 10c)30, 18, 17, 12, 11, 10, 19d)30, 18, 19, 12, 11, 17, 10Correct answer is option 'A'. Can you explain this answer? for GATE 2024 is part of GATE preparation. The Question and answers have been prepared according to the GATE exam syllabus. Information about Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:a)30, 18, 19, 12, 11, 10, 17b)30, 19, 18, 12, 11, 17, 10c)30, 18, 17, 12, 11, 10, 19d)30, 18, 19, 12, 11, 17, 10Correct answer is option 'A'. Can you explain this answer? covers all topics & solutions for GATE 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:a)30, 18, 19, 12, 11, 10, 17b)30, 19, 18, 12, 11, 17, 10c)30, 18, 17, 12, 11, 10, 19d)30, 18, 19, 12, 11, 17, 10Correct answer is option 'A'. Can you explain this answer?.
Solutions for Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:a)30, 18, 19, 12, 11, 10, 17b)30, 19, 18, 12, 11, 17, 10c)30, 18, 17, 12, 11, 10, 19d)30, 18, 19, 12, 11, 17, 10Correct answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for GATE. Download more important topics, notes, lectures and mock test series for GATE Exam by signing up for free.
Here you can find the meaning of Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:a)30, 18, 19, 12, 11, 10, 17b)30, 19, 18, 12, 11, 17, 10c)30, 18, 17, 12, 11, 10, 19d)30, 18, 19, 12, 11, 17, 10Correct answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:a)30, 18, 19, 12, 11, 10, 17b)30, 19, 18, 12, 11, 17, 10c)30, 18, 17, 12, 11, 10, 19d)30, 18, 19, 12, 11, 17, 10Correct answer is option 'A'. Can you explain this answer?, a detailed solution for Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:a)30, 18, 19, 12, 11, 10, 17b)30, 19, 18, 12, 11, 17, 10c)30, 18, 17, 12, 11, 10, 19d)30, 18, 19, 12, 11, 17, 10Correct answer is option 'A'. Can you explain this answer? has been provided alongside types of Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:a)30, 18, 19, 12, 11, 10, 17b)30, 19, 18, 12, 11, 17, 10c)30, 18, 17, 12, 11, 10, 19d)30, 18, 19, 12, 11, 17, 10Correct answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Initially a priority queue had 5 elements and it is being implemented as Max-Heap. Let’s say the level order traversal of the heap is: 30, 18, 17, 12, 11. Now two more elements are inserted into the heap i.e. 10 and 19 in the same order. The level order traversal of the heap after the insertion is:a)30, 18, 19, 12, 11, 10, 17b)30, 19, 18, 12, 11, 17, 10c)30, 18, 17, 12, 11, 10, 19d)30, 18, 19, 12, 11, 17, 10Correct answer is option 'A'. Can you explain this answer? tests, examples and also practice GATE tests.
Explore Courses for GATE exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev