Heap Tree: GATE CS Previous Year Questions

Heap Tree · Data Structures

32 questions · asked in 20 of 27 years (2000–2026)

MCQ 27 · MSQ 1 · NAT 41-mark 19 · 2-mark 13

2000Questions per year2026

Questions 21–25 of 32

Q21GATE 20082 marksMCQ−0.67 if wrong
We have a binary heap on n elements and wish to insert n more elements (not necessarily one after another) into this heap. The total time required for this is

Q22GATE 20071 markMCQ−0.33 if wrong
Consider the process of inserting an element into a Max Heap, where the Max Heap is represented by an array. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of comparisons performed is:

Q23GATE 20061 markMCQ−0.33 if wrong
Which of the following sequences of array elements forms a heap?

Q24GATE 20061 markMCQ−0.33 if wrong
A 3-ary max heap is like a binary max heap, but instead of 2 children, nodes have 3 children. A 3-ary heap can be represented by an array as follows: The root is stored in the first location, a[0], nodes in the next level, from left to right, is stored from a[1] to a[3]. The nodes from the second level of the tree from left to right are stored from a[4] location onward. An item x can be inserted into a 3-ary heap containing n items by placing x in the location a[n] and pushing it up the tree to satisfy the heap property.

Suppose the elements 7, 2, 10 and 4 are inserted, in that order, into the valid 3-ary max heap found in the above question (the array 9, 5, 6, 8, 3, 1), Which one of the following is the sequence of items in the array representing the resultant heap?

Q25GATE 20061 markMCQ−0.33 if wrong
A 3-ary max heap is like a binary max heap, but instead of 2 children, nodes have 3 children. A 3-ary heap can be represented by an array as follows: The root is stored in the first location, a[0], nodes in the next level, from left to right, is stored from a[1] to a[3]. The nodes from the second level of the tree from left to right are stored from a[4] location onward. An item x can be inserted into a 3-ary heap containing n items by placing x in the location a[n] and pushing it up the tree to satisfy the heap property.

Which one of the following is a valid sequence of elements in an array representing 3-ary max heap?

Keep practising

Topics in Data Structures

All CS topics ›