question about sorting

Posted by skydoor on Stack Overflow See other posts from Stack Overflow or by skydoor
Published on 2010-03-17T02:23:11Z Indexed on 2010/03/17 2:31 UTC
Read the original article Hit count: 453

Filed under:
|

Bubble sort is O(n) at best, O(n^2) at worst, and its memory usage is O(1) . Merge sort is always O(n log n), but its memory usage is O(n).

Which algorithm we would use to implement a function that takes an array of integers and returns the max integer in the collection, assuming that the length of the array is less than 1000. What if the array length is greater than 1000?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about sorting