Step 1: Declare array 'k' of size 'n' i.e. k(n) is an array which stores all the keys of a file containing 'n' records
Step 2: i←0
Step 3: low←0, high←n-1
Step 4: while (low <= high)do
mid = (low + high)/2
if (key=k[mid]) then
write "record is at position", mid+1 //as the array starts from the 0th position
else
if(key < k[mid]) then
high = mid - 1
else
low = mid + 1
endif
endif
endwhile
Step 5: Write "Sorry, key value not found"
Step 6: Stop