ISRO-2016
September 30, 2023
Process-Scheduling
October 2, 2023
ISRO-2016
September 30, 2023
Process-Scheduling
October 2, 2023

Algorithms

Question 1

An array of integers of size n can be converted into a heap by adjusting the heaps rooted at each internal node of the complete binary tree starting at the node ⌊(n – 1) /2⌋, and doing this adjustment up to the root node (root node is at index 0) in the order ⌊(n – 1)/2⌋, ⌊(n – 3)/2⌋, ….., 0. The time required to construct a heap in this manner is

A
O(log n)
B
O(n)
C
O(n log log n)
D
O(n log n)
Question 1 Explanation: 
The above statement is actually algorithm for building a heap of an input array A.
And we know that time complexity for building the heap is O(n).
Correct Answer: B
Question 1 Explanation: 
The above statement is actually algorithm for building a heap of an input array A.
And we know that time complexity for building the heap is O(n).
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!!