Examveda

What does this pseudo_code return?
int myfun(heap_arr[])
{
	int mini=INF;
	for(int i=0;i<tot_node;i++)
	mini=min(mini,heap_arr)
	return mini;
}

A. Last added element to heap

B. First element added to heap

C. Root of the heap

D. Leftmost node of the heap

Answer: Option C


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.