Question: Pseudocode: function binary_search(A, n, T) is L := 0 R := n 1 while L R do m := floor((L + R) / 2) if
Pseudocode:
function binary_search(A, n, T) is
L := 0
R := n 1
while L R do
m := floor((L + R) / 2)
if A[m] < T then
L := m + 1
else if A[m] > T then
R := m 1
else:
return m
return unsuccessful
Implement the C++ Binary Search algorithm in your compiler and then use it to compare searching times with the find function of the STL. To perform the test, cretae an array or vector of at least 100,000 elements. Which algorithm is faster and by how much? Put your analysis in comments at the end of your program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
