// 折半查找 二分查找
void mid_find(int *p, int left, int right, int find)
{
if(left > right)
{
qDebug() << "no item";
return;
}
int mid = (right+left) / 2;
int mid_item = *(p+mid);
if(mid_item > find){
mid_find(p, left, (left+right)/2 - 1, find);
}else if(mid_item < find){
mid_find(p, (left+right)/2 + 1, right, find);
}else{
qDebug() << "find item";
}
}
// 冒泡排序
void maopao_sort(int *p, int len){
for(int i = 0; i < len; i++){
for(int j = i; j < len; j++){
if(*(p+j) > *(p+j+1)){
int temp = *(p+j+1);
*(p+j+1) = *(p+j);
*(p+j) = temp;
}
}
}
}