Find next lower item in a sorted list
<p>let's say I have a sorted list of Floats. Now I'd like to get the index of the next lower item of a given value. The usual for-loop aprroach has a complexity of O(n). Since the list is sorted there must be a way to get the index with O(log n).</p>

<p>My O(n) approach:</p>

<pre><code>index=0
for i,value in enumerate(mylist):
    if value&gt;compareValue:
        index=i-1
</code></pre>

<p>Is there a datatype for solving that problem in O(log n)?</p>

<p>best regards
Sebastian</p>
