HackerRank Recursions and Heap Quiz-2

Question 1

Time: 00:00:00
What do you understand by Heap in Data Structures?

balanced binary tree data structure

balanced binary tree data structure

complete binary tree

complete binary tree

both

both

none

none

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
There are two types of Heap such as Min-Heap and Max-Heap.

Yes

Yes

No

No

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
What do you mean by Max-heap?

the value of the root node is greater than or equal to either of its children

the value of the root node is greater than or equal to either of its children

the value of the root node is less than or equal to either of its children

the value of the root node is less than or equal to either of its children

balanced binary tree data structure

balanced binary tree data structure

None

None

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What do you mean by Min-heap?

the value of the root node is less than or equal to either of its children

the value of the root node is less than or equal to either of its children

the value of the root node is greater than or equal to either of its children

the value of the root node is greater than or equal to either of its children

the value of the root node equal to either of its children

the value of the root node equal to either of its children

none

none

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is the worst and Average complexity of heap sort?

O(log2 n)

O(log2 n)

O(log n)

O(log n)

O(n log2 n)

O(n log2 n)

O n (log2 n)

O n (log2 n)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
The steps needed to sort element using Heap sort algorithm are :

Start from the given array, build the initial max heap

Start from the given array, build the initial max heap

Interchange the root element with the last element

Interchange the root element with the last element

Use repetitive downward operation from the root node to rebuild the heap of size one less than the starting

Use repetitive downward operation from the root node to rebuild the heap of size one less than the starting

All steps are needed to sort element

All steps are needed to sort element

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
The following is the algorithm of :-
PQR(A)
XYZ(A)
for i<-length[A] down to 2
do exchange A[1] heap-size[A]-1
heap-size[A]<-heap-size[A]-1
MNO(A,1)

HEAP-SORT(A)

HEAP-SORT(A)

BUILD-MAX-HEAP(A)

BUILD-MAX-HEAP(A)

MAX-HEAPIFY(A, i)

MAX-HEAPIFY(A, i)

None

None

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What is the location of 10 if a max heap is constructed on the 15, 70, 45, 17, 20, 50, 73, 65, 25, 45 input elements?

10 will be inserted at the first level

10 will be inserted at the first level

10 will be inserted at the last level

10 will be inserted at the last level

10 will be inserted at the second level

10 will be inserted at the second level

None

None

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What is the result of this pseudocode?
int PrepInsta(heap_arr[])
{
int mini=INF;
for(int i=0;i
mini=min(mini,heap_arr)
return mini;
}

Last element

Last element

first element

first element

root node

root node

none

none

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
Heap is used in

Dijkstra's algorithm

Dijkstra's algorithm

Sorting algorithm

Sorting algorithm

Access the maximum or minimum element very quickly

Access the maximum or minimum element very quickly

All the mentioned

All the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]