IBM
Company
Programming
Arrays
Best method to find out whether a given array already sorted,is sorted or not in minute time
Read Solution (Total 3)
-
- Perform binary search method
- 8 years agoHelpfull: Yes(0) No(1)
- well,Binary search method is more efficient when compare to other.
here is the proof,this table gives the number of comparisons
ARRAY 100 1000
linear search 50.5 500.5
binary search 7.72 10.9
so the fast one is Binary search - 8 years agoHelpfull: Yes(0) No(0)
- How can binary search tell you whether all the array is sorted or not?
- 8 years agoHelpfull: Yes(0) No(0)
IBM Other Question