1.

What is the use of front() function in heap?(a) Returns the element closest to the median of a sequence(b) Returns the last element of the heap(c) Returns the first element of the heap(d) Returns the element closest to mean of a sequenceThis question was posed to me by my college professor while I was bunking the class.My question comes from STL in division Class Hierarchies, Library & Containers of C++

Answer»

The CORRECT choice is (c) Returns the first element of the heap

Easiest EXPLANATION - C++ STL-heap CONTAINER provides the front() function that returns the first element of the heap i.e. the MAXIMUM number of the sequence.



Discussion

No Comment Found

Related InterviewSolutions