Hi experts,
I have an array,I want to find the Min and Max value in a more efficient way than just itterating it,is there any way better?
thanks.
Printable View
Hi experts,
I have an array,I want to find the Min and Max value in a more efficient way than just itterating it,is there any way better?
thanks.
the best structure for finding min and max item in a collection is min-max heap,but seems you just have to use arrays,so you can make it more efficient by comparing pair elements with current min or max ,it would take o(n) but it is more efficient than checking elements one by one.