#include <iostream>
using namespace std;
int find(int a[],int low,int high){
if(low==high){
return a[low];
}else{
int mid=(high+low)/2;
int left=find(a,low,mid);
int right=find(a,mid+1,high);
return left>right?left:right;
}
}
int main()
{//时间复杂度O(n)
int a[9]={1,2,3,114,15,6,7,8,9};
cout<<find(a,0,8);
return 0;
}
最后
以上就是能干月亮最近收集整理的关于分治法求数组最大整数的全部内容,更多相关分治法求数组最大整数内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复