Sort (quicksort) has an average O(n*log2(n))
complexity.
Finding min or max of an array has just O(n)
complexity.
Therefore the second is much faster.
3
solved max value and min value time complexity O in c++
Sort (quicksort) has an average O(n*log2(n))
complexity.
Finding min or max of an array has just O(n)
complexity.
Therefore the second is much faster.
3
solved max value and min value time complexity O in c++