Question:
Pseudo code of how to prgram binary search
Author: Will ParkerAnswer:
Found ← FALSE BottomPointer ← 0 TopPointer ← ArrayofNames.Count - 1 Do Until Found = TRUE or TopPointer < BottomPointer Midpoint = int mid TopPointer, BottomPointer If ArrayofNames(Midpoint) = Target Found = TRUE ElseIf ArrayofNames(Midpoint) > Target TopPointer = Midpoint - 1 ElseIf ArrayofNames(Midpoint) < Target BottomPointer = Midpoint + 1 Loop If Found = TRUE Output "Target found at " + Midpoint Else Output Target not found
0 / 5 (0 ratings)
1 answer(s) in total
Author
Will Parker