find the index i of a sorted array y[:], such that y[i-1] <= x <y[i] : <pre><code>getindex(x,y) 
</code></pre>

<p><strong>Input:</strong> a value <code>x</code>, and a sorted array <code>y[:]</code>  (no repeat element)</p>

<p><strong>Output:</strong> the index  <code>i</code>, such that <code>y[i-1] &lt;= x &lt;y[i]</code></p>

<p>The time complexity  should be <strong>O(log(N))</strong></p>

<p>Is there a Python/Numpy function we can use?</p>

<p><strong>For example:</strong></p>

<pre><code>y[0]=-0.2
y[1]=1.5
y[2]=1.9
y[3]=3.2
</code></pre>

<p>Then</p>

<p><code>getindex(-4.0,y)</code> returns 0</p>

<p><code>getindex(0.5,y)</code> returns 1</p>

<p><code>getindex(6.0,y)</code> returns 4</p>
