C language program half-search algorithm