摘要: /** description:分治法找最大值例子* writeby: nick* date: 2012-10-22 23:56*/#include <iostream>using namespace std;typedef int item;item max(item a[], int l, int r){ if(l==r) return a[l]; int m = (l+r)/2; item u = max(a, l, m); //查找左边最大 item v = max(a, m+1, r);//查找右边最大 return u>... 阅读全文
posted @ 2012-10-22 23:58 wouldguan 阅读(1609) 评论(0) 推荐(0)