Binary search: Difference between revisions
Content deleted Content added
→{{header|C sharp|C#}}: Reversed recursion and exit cases in the RecursiveBinarySearch methods. Reversed recursion and exit cases in the RecursiveBinarySearch methods. Reinstated public interface overloads. |
→{{header|Pascal}}: The high function returns the last index. So, -1 does not need. |
||
Line 3,130: | Line 3,130: | ||
l, m, h: integer; |
l, m, h: integer; |
||
begin |
begin |
||
l := |
l := Low(list); |
||
h := High(list) |
h := High(list); |
||
binary_search := -1; |
binary_search := -1; |
||
while l <= h do |
while l <= h do |