NTA UGC NET JUNE-2023 Paper-2
December 3, 2023
Artificial-Intelligence
December 3, 2023
NTA UGC NET JUNE-2023 Paper-2
December 3, 2023
Artificial-Intelligence
December 3, 2023

NTA UGC NET JUNE-2023 Paper-2

Question 22
Consider the following statements about heap sort algorithm

A.The MAX-HEAPIFY procedure which runs in O lg(n) time, is the key to maintaining the max heap property
B. The BUILD-MAX-HEAP procedure which runs in O lg(n) time,produces max-heap from an unordered input array
C. The MAX-HEAP-INSERT, which runs in O(lg n) time, implements the insertion operation
D.The HEAP-INCREASE-KEY procedure runs in O(nlg n) time, to set the key of new node of its correct value
Choose the correct answer from the options given below

A
A,B only
B
A,C only
C
B,D only
D
A,B,C,D
Question 22 Explanation: 
A. The statement “The MAX-HEAPIFY procedure which runs in O(log n) time, is the key to maintaining the max heap property” is correct.

B. The statement “The BUILD-MAX-HEAP procedure which runs in O(log n) time, produces a max-heap from an unordered input array” is incorrect. BUILD-MAX-HEAP typically runs in O(n) time, not O(log n) time. It’s used to create a max-heap from an unordered array.

C. The statement “The MAX-HEAP-INSERT, which runs in O(log n) time, implements the insertion operation” is correct. MAX-HEAP-INSERT is used for inserting elements into a max-heap and typically runs in O(log n) time.

D. The statement “The HEAP-INCREASE-KEY procedure runs in O(n log n) time, to set the key of a new node to its correct value” is incorrect. HEAP-INCREASE-KEY usually runs in O(log n) time, not O(n log n) time.

So, the correct statements are A and C

Correct Answer: B
Question 22 Explanation: 
A. The statement “The MAX-HEAPIFY procedure which runs in O(log n) time, is the key to maintaining the max heap property” is correct.

B. The statement “The BUILD-MAX-HEAP procedure which runs in O(log n) time, produces a max-heap from an unordered input array” is incorrect. BUILD-MAX-HEAP typically runs in O(n) time, not O(log n) time. It’s used to create a max-heap from an unordered array.

C. The statement “The MAX-HEAP-INSERT, which runs in O(log n) time, implements the insertion operation” is correct. MAX-HEAP-INSERT is used for inserting elements into a max-heap and typically runs in O(log n) time.

D. The statement “The HEAP-INCREASE-KEY procedure runs in O(n log n) time, to set the key of a new node to its correct value” is incorrect. HEAP-INCREASE-KEY usually runs in O(log n) time, not O(n log n) time.

So, the correct statements are A and C

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!