Talk:Binary search: Difference between revisions

no edit summary
m (→‎Python: sign entry on behalf of user)
No edit summary
 
Line 29:
Is there any reason why <code>n</code> is passed as argument in <code>int bsearch_r (int *a, int n, int x, int i, int j)</code> ? --[[User:Natema|Natema]] ([[User talk:Natema|talk]]) 05:31, 10 February 2016 (UTC)
: I agree with your hint - that parameter does look to be unnecessary. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 11:42, 10 February 2016 (UTC)
 
== MATLAB ==
 
It seems the initial value for 'high' in the iterative example is too low:
<pre>high = numel(list) - 1; </pre>
For a list with one entry, the solution shown will access element 0 of 'list', out of bounds.
1

edit