Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#!/bin/ksh
# This should work on any clone of Bourne Shell, ksh is the fastest.
value=$1; [ -z "$value" ] && exit
array=()
size=0
while IFS= read -r line; do
size=$(($size + 1))
array[${#array[*]}]=$line
done

View file

@ -0,0 +1,15 @@
left=0
right=$(($size - 1))
while [ $left -le $right ] ; do
mid=$((($left + $right) >> 1))
# echo "$left $mid(${array[$mid]}) $right"
if [ $value -eq ${array[$mid]} ] ; then
echo $mid
exit
elif [ $value -lt ${array[$mid]} ]; then
right=$(($mid - 1))
else
left=$((mid + 1))
fi
done
echo 'ERROR 404 : NOT FOUND'

View file

@ -0,0 +1 @@
No code yet