Binary search: Difference between revisions

→‎{{header|UNIX Shell}}: Cosmetic changes
(→‎{{header|UNIX Shell}}: Cosmetic changes)
Line 3,421:
<lang bash>
#!/bin/ksh
# This should work on any clone of Bourne Shell, ksh is the fastest.
 
value=$1; [ -z "$value" ] && exit
Line 3,441 ⟶ 3,442:
# echo "$left $mid(${array[$mid]}) $right"
if [ $value -eq ${array[$mid]} ] ; then
echo "$value $mid"
exit
elif [ $value -lt ${array[$mid]} ]; then
Anonymous user