二分查找

  仍是编程珠玑上的东西,做者对最初的算法稍微优化了一下。html #include <iostream> #include <algorithm> #define N 10 using namespace std; int binary_search(int *x,int n,int t) //x为要查找的数组,n为数组的大小,t为要找的值,找到则返回值的位置,不然返回-1 {
相关文章
相关标签/搜索