I have a JSONArray in an Android application that has the following entries, for instance,
[start : 0.100 , stop : 2.312]
[start : 2.313 , stop : 4.565]
[start : 4.566 , stop : 7.898]
...
...
...
[start 85.123 , stop : 97.659]
now giving a value = 86.235, I want to get the index of which this number is greater than and less than
start <= value <= stop
without traversing the entire array each time I want to look for an entry? Is this possible by mapping this to a different data structure or do I have to traverse the array each time to figure out which item in the array this is greater than and less than?
If it is sorted. The fastest would be Binary Search. That meets the requirment of
Since O (logn) < n .