I was asked in an interview:
What is the best time complexity in getting the min element(s) from a max-heap?
I replied as O(1) assuming the heap size is known and the heap is implemented as a binary heap using an array. This way as per my assumption, the min value is at heap_array[heap_size]
.
My question is that if this answer is correct. If not, what is the correct answer?