Monday, August 22, 2011

Find minimum and maximum in an unsorted array in minimum number of comparisons.

This is certainly linear, but how can you minimize the #of comparison.

Hint: think about the way we build an heap.

1 comment:

  1. max heap ( o(1) for finding maximum) and o(n* logn for minimum)

    ReplyDelete