The code here is from section 5 of "Programming Pearls". All the algorithms are searches which assume a sorted list, and look for a given entry. For testing, two integers are input n t which set x[j=0..(n-1)] = 10*j and then look for t such that x[i]=t. If successful, i is returned; otherwise, -1 is returned. Here's an example of running it. $ wget http://netlib.bell-labs.com/cm/cs/pearls/search.c $ cp search.c search.c_orig # .. edit search.c .. # main is probe1 # probe1 does seqsearch1 # $ make search cc -march=pentium4 -O3 search.cc -o search $ binary_search$ ./search 10 5 (a) x=(0,10,...,90), look for 5 -1 not found 100 60 (b) x=(0,10,...990, look for 60 6 found at i=6 ^d (c) type control-d to indicate the end of the file $