#include <stdio.h> int main () { int A [] = { . 1 , 2 , . 3 , . 4 , . 5 , . 6 , . 7 , . 8 , . 9 , 10 , . 11 , 12 is , 13 is , 14 , 15 }; int = L the sizeof (a) / . 4 ; // length int X = 10 ; // to find the value of int Bisection ( int X, int * A, int L); Bisection (X, A, L); return 0 ; } int Bisection ( int X, int * A, int L) { int address; // find the location of the number of // consider two end position IF (X == a [L- . 1 ]) { address = L- . 1 ; the printf ( " % D \ n- " , address); return address; } the else IF (a == X [ 0 ]) { address =0; printf("%d\n",address); return address; } //如果不在两端 address=l/2; l=l/2; while(true){ if(x==a[address]){ printf("%d\n",address); break; }else if(x>a[address]){ l=l/2; address=address+L; } the else IF (X < A [address]) { L = L / 2 ; address = Address- L; } IF (L == 0 ) { // If l = 0 can not be found indicating the printf ( " Not found " ); BREAK ; } } return address; }