Examveda

An array consists of n elements. We want to create a heap using the elements. The time complexity of building a heap will be in order of

A. O(n*n*logn)

B. O(n*logn)

C. O(n*n)

D. O(n *logn *logn)

Answer: Option B


This Question Belongs to Data Structure >> Heaps

Join The Discussion

Related Questions on Heaps

Which of the following is true for a min-heap?

A. The root node is the smallest element, and every parent node is smaller than its children.

B. The root node is the largest element, and every parent node is larger than its children.

C. All nodes are arranged in a complete binary tree.

D. The tree is always balanced.