DAY-4 DSA BOOTCAMP HEAP

DAY-4 DSA BOOTCAMP HEAP

University

10 Qs

quiz-placeholder

Similar activities

Binary Tree Searching - Data Structures

Binary Tree Searching - Data Structures

University

15 Qs

HeapSort

HeapSort

University

6 Qs

HEAP TREE

HEAP TREE

University

11 Qs

Searching and Sorting

Searching and Sorting

University - Professional Development

15 Qs

HEAP

HEAP

University

10 Qs

BCSC0006 Trees

BCSC0006 Trees

University

10 Qs

Sorting in Data Structures

Sorting in Data Structures

University

15 Qs

Data Structuer

Data Structuer

University

12 Qs

DAY-4 DSA BOOTCAMP HEAP

DAY-4 DSA BOOTCAMP HEAP

Assessment

Quiz

Computers

University

Hard

Created by

ATHARVA GALNE

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Given two max heaps of size n each, what is the minimum possible time complexity to make a one max-heap of size from elements of two max heaps?

O(n^2)

O(nLogLogn)

O(n)

O(nLogn)

Answer explanation

We can build a heap of 2n elements in O(n) time. Following are the steps. Create an array of size 2n and copy elements of both heaps to this array. Call build heap for the array of size 2n. Build heap operation takes O(n) time.

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of the following Binary Min Heap operation has the highest time complexity?

Inserting an item under the assumption that the heap has capacity to accommodate one more item

Merging with another heap under the assumption that the heap has capacity to accommodate items of other heap

Deleting an item from heap

Decreasing value of a key

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider a max heap, represented by the array: 40, 30, 20, 10, 15, 16, 17, 8, 4. Now consider that a value 35 is inserted into this heap. After insertion, the new heap is

40, 30, 20, 10, 15, 16, 17, 8, 4, 35

40, 35, 20, 10, 30, 16, 17, 8, 4, 15

40, 30, 20, 10, 35, 16, 17, 8, 4, 15

40, 35, 20, 10, 15, 16, 17, 8, 4, 30

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following array of elements. 〈89, 19, 50, 17, 12, 15, 2, 5, 7, 11, 6, 9, 100〉. The minimum number of interchanges needed to convert it into a max-heap is

4

3

5

2

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the time complexity of Build Heap operation? 
(Build Heap is used to build a max(or min) binary heap from a given array. Build Heap is used in Heap Sort as a first step for sorting.)

O(nLogn)

O(n^2)

O(n)

O(logn)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Suppose we are sorting an array of eight integers using heapsort, and we have just finished some heapify (either maxheapify or minheapify) operations. The array now looks like this: 16 14 15 10 12 27 28 How many heapify operations have been performed on root of heap?

1

2

3 or 4

5 or 6

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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, Which one of the following is the sequence of items in the array representing the resultant heap?

10, 7, 9, 8, 3, 1, 5, 2, 6, 4

10, 9, 8, 7, 6, 5, 4, 3, 2, 1

10, 9, 4, 5, 7, 6, 8, 2, 1, 3

10, 8, 6, 9, 7, 2, 3, 4, 1, 5

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?