the most common way to loop through an array is this:
DEF SEARCH(ARRAY,LOOK)
FOR I = 0 TO LEN(ARRAY)-1
IF ARRAY[I]==LOOK THEN RETURN I
NEXT
END
but this is very inefficient speed-wise.
but an alternative, which is 25% faster is bilinear search:
DEF BILINEARSEARCH(ARRAY,LOOK)
VAR L = LEN(ARRAY)-1,L2=L/2
FOR I = 0 TO L2
IF ARRAY[L2+I]==LOOK THEN RETURN L2+I
IF ARRAY[L2-I]==LOOK THEN RETURN L2-I
NEXT
IF ARRAY[L]==LOOK THEN RETURN L
RETURN -1
END

5 Comment(s)DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strengththis is a parodyY_ack??DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strengthyou referenced this and called it a parodyY_ackI called super search a parody of this page.DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthOH OK!