Searching Algorithm Flashcards
1
Q
Binary Search
A
SET found = false input key REPEAT SET middle to (startpos+endpos) / 2 IF array(middle) = searchkey then SET found to true Output suitable message ELSE IF array(middle) < Search Key THEN endpos = middle ELSE startPos = middle END IF END IF UNTIL found = true OR (startPos > endPos) IF found = false THEN output ‘not found’ message END IF