GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /nginx/html/JimMartinson/_Archive/CST1794/ExampleFiles/ |
Upload File : |
' BinarySearchOptimized.bas MAXSIZE=9 [again] print print addTo = 0 dim myArray(MAXSIZE) for i = 1 to MAXSIZE newRandowNumber = int(rnd(1)*10)+1 myArray(i) = newRandowNumber+addTo print "#";i;" ";myArray(i) addTo = myArray(i) next i print 'toSearchFor = myArray(toSearchForIndex) ' Search for a number that exists toSearchFor = int(rnd(1)*50)+int(rnd(1)*51)+1 ' Search for a random number print "toSearchFor=";toSearchFor fountIt=0 startAt=1 endAt=MAXSIZE While fountIt=0 and startAt<=endAt searchAt = int((startAt+endAt)/2) print "startAt=";startAt;" endAt=";endAt;" searchAt=";searchAt;" "; if toSearchFor < myArray(searchAt) then print toSearchFor;"<";myArray(searchAt) endAt = searchAt-1 else if toSearchFor > myArray(searchAt) then print toSearchFor;">";myArray(searchAt) startAt = searchAt+1 if endAt < startAt then fountIt = -1 else print fountIt=searchAt end if end if wend if fountIt > 0 then print "Found the number ";toSearchFor;" at position ";fountIt;"." else print "The number ";toSearchFor;" was not found." end if Input "Again? ";again$ if again$="" goto [again]