# 第三次小考. #include using namespace std; int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="< Published byKaylee Fogg Modified over 2 years ago

## Presentation on theme: "第三次小考. #include using namespace std; int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="< 1 第三次小考 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_1.jpg", "name": "第三次小考", "description": "第三次小考", "width": "800" } 2 #include using namespace std; int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } int main() { int ia[10]={0,2,3,6,8,6,12,28,16,11}; cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_2.jpg", "name": "#include using namespace std; int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <v)return u;else return v; } int main() { int ia[10]={0,2,3,6,8,6,12,28,16,11}; cout<v)return u;else return v; } int main() { int ia[10]={0,2,3,6,8,6,12,28,16,11}; cout< 3 aaa(ib,0,9) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_3.jpg", "name": "aaa(ib,0,9)", "description": "aaa(ib,0,9)", "width": "800" } 4 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=0 ， a2=9 m=(0+9)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 4 a1=0 ， a2=9  沒有 return 傳入 aaa(ib,0,4) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_4.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=9 m=(0+9)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 4 a1=0 ， a2=9  沒有 return 傳入 aaa(ib,0,4)", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=9 m=(0+9)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 4 a1=0 ， a2=9  沒有 return 傳入 aaa(ib,0,4)", "width": "800" } 5 aaa(ib,0,9) aaa(ib,0,4) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_5.jpg", "name": "aaa(ib,0,9) aaa(ib,0,4)", "description": "aaa(ib,0,9) aaa(ib,0,4)", "width": "800" } 6 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=0 ， a2=4 m=(0+4)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 2 a1=0 ， a2=4  沒有 return 傳入 aaa(ib,0,2) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_6.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=4 m=(0+4)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 2 a1=0 ， a2=4  沒有 return 傳入 aaa(ib,0,2)", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=4 m=(0+4)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 2 a1=0 ， a2=4  沒有 return 傳入 aaa(ib,0,2)", "width": "800" } 7 aaa(ib,0, 9) aaa(ib,0, 4) aaa(ib,0, 2) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_7.jpg", "name": "aaa(ib,0, 9) aaa(ib,0, 4) aaa(ib,0, 2)", "description": "aaa(ib,0, 9) aaa(ib,0, 4) aaa(ib,0, 2)", "width": "800" } 8 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=0 ， a2=2 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=2  沒有 return 傳入 aaa(ib,0,1) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_8.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=2 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=2  沒有 return 傳入 aaa(ib,0,1)", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=2 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=2  沒有 return 傳入 aaa(ib,0,1)", "width": "800" } 9 aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_9.jpg", "name": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1)", "description": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1)", "width": "800" } 10 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=0 ， a2=1 m=(0+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 0 a1=0 ， a2=1  沒有 return 傳入 aaa(ib,0,0) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_10.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=1 m=(0+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 0 a1=0 ， a2=1  沒有 return 傳入 aaa(ib,0,0)", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=1 m=(0+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 0 a1=0 ， a2=1  沒有 return 傳入 aaa(ib,0,0)", "width": "800" } 11 aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_11.jpg", "name": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0)", "description": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0)", "width": "800" } 12 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=0 ， a2=0 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=0  return ib[0] { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_12.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=0 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=0  return ib[0]", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=0 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=0  return ib[0]", "width": "800" } 13 aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0) return ib[0] (ib[0]=0) u=aaa(ib,0,0)=0 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_13.jpg", "name": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0) return ib[0] (ib[0]=0) u=aaa(ib,0,0)=0", "description": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0) return ib[0] (ib[0]=0) u=aaa(ib,0,0)=0", "width": "800" } 14 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=0 ， a2=1 m=(0+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 0 a1=0 ， a2=1  沒有 return aaa(ib,0,0) return ib[0] 所以 u=ib[0] (u=0) u=0 傳入 aaa(ib,1,1) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_14.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=1 m=(0+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 0 a1=0 ， a2=1  沒有 return aaa(ib,0,0) return ib[0] 所以 u=ib[0] (u=0) u=0 傳入 aaa(ib,1,1)", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=1 m=(0+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 0 a1=0 ， a2=1  沒有 return aaa(ib,0,0) return ib[0] 所以 u=ib[0] (u=0) u=0 傳入 aaa(ib,1,1)", "width": "800" } 15 aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_15.jpg", "name": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1)", "description": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1)", "width": "800" } 16 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=1 ， a2=1 m=(1+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=a2=1  return ib[1] { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_16.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=1 ， a2=1 m=(1+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=a2=1  return ib[1]", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=1 ， a2=1 m=(1+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=a2=1  return ib[1]", "width": "800" } 17 aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2) v=aaa(ib,1,1)=2 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_17.jpg", "name": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2) v=aaa(ib,1,1)=2", "description": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2) v=aaa(ib,1,1)=2", "width": "800" } 18 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=0 ， a2=1 m=(0+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 0 a1=0 ， a2=1  沒有 return 傳入 aaa(ib,0,0) u = 0 v = aaa(ib,1,1) v = 2 u=0,v = 2 v>u return v (v=2) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_18.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=1 m=(0+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 0 a1=0 ， a2=1  沒有 return 傳入 aaa(ib,0,0) u = 0 v = aaa(ib,1,1) v = 2 u=0,v = 2 v>u return v (v=2)", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=1 m=(0+1)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 0 a1=0 ， a2=1  沒有 return 傳入 aaa(ib,0,0) u = 0 v = aaa(ib,1,1) v = 2 u=0,v = 2 v>u return v (v=2)", "width": "800" } 19 v>u return v (v=2) aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_19.jpg", "name": "v>u return v (v=2) aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2)", "description": "v>u return v (v=2) aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2)", "width": "800" } 20 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=0 ， a2=2 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=2  沒有 return u=aaa(ib,0,1)=2 u=2 傳入 aaa(ib,2,2) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_20.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=2 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=2  沒有 return u=aaa(ib,0,1)=2 u=2 傳入 aaa(ib,2,2)", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=2 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=2  沒有 return u=aaa(ib,0,1)=2 u=2 傳入 aaa(ib,2,2)", "width": "800" } 21 aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2) aaa(ib,2,2) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_21.jpg", "name": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2) aaa(ib,2,2)", "description": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2) aaa(ib,2,2)", "width": "800" } 22 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=2 ， a2=2 m=(2+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 2 a1=a2=2  return ib[2] (ib[2]=3) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_22.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=2 ， a2=2 m=(2+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 2 a1=a2=2  return ib[2] (ib[2]=3)", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=2 ， a2=2 m=(2+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 2 a1=a2=2  return ib[2] (ib[2]=3)", "width": "800" } 23 aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2) aaa(ib,2,2) v=3 return ib[2] (ib[2]=3) v=aaa(ib,2,2)=3 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_23.jpg", "name": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2) aaa(ib,2,2) v=3 return ib[2] (ib[2]=3) v=aaa(ib,2,2)=3", "description": "aaa(ib,0,9) aaa(ib,0,4) aaa(ib,0,2) aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] (ib[0]=0) aaa(ib,1,1) v=2 return ib[1] (ib[1]=2) aaa(ib,2,2) v=3 return ib[2] (ib[2]=3) v=aaa(ib,2,2)=3", "width": "800" } 24 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=0 ， a2=2 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=2  沒有 return u=aaa(ib,0,1)=2 u=2 傳入 aaa(ib,2,2) v=3 u=2,v = 3 v>u return v (v=3) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_24.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=2 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=2  沒有 return u=aaa(ib,0,1)=2 u=2 傳入 aaa(ib,2,2) v=3 u=2,v = 3 v>u return v (v=3)", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=2 m=(0+2)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 1 a1=0 ， a2=2  沒有 return u=aaa(ib,0,1)=2 u=2 傳入 aaa(ib,2,2) v=3 u=2,v = 3 v>u return v (v=3)", "width": "800" } 25 v>u return v (v=3) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_25.jpg", "name": "v>u return v (v=3)", "description": "v>u return v (v=3)", "width": "800" } 26 int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<<"u="<v)return u;else return v; } 傳入參數 a1=0 ， a2=4 m=(0+4)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 2 a1=0 ， a2=4  沒有 return 傳入 aaa(ib,0,2) aaa(ib,0,2) = 3 u = 3 傳入 aaa(ib,3,4) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_26.jpg", "name": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=4 m=(0+4)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 2 a1=0 ， a2=4  沒有 return 傳入 aaa(ib,0,2) aaa(ib,0,2) = 3 u = 3 傳入 aaa(ib,3,4)", "description": "int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout<< u= <<u<< \n ; v=aaa(ib,m+1,a2); cout<< v= <<v<< \n ; if(u>v)return u;else return v; } 傳入參數 a1=0 ， a2=4 m=(0+4)/2 …… 因為 m 屬於 int ，所以 m 等於整數部份 m = 2 a1=0 ， a2=4  沒有 return 傳入 aaa(ib,0,2) aaa(ib,0,2) = 3 u = 3 傳入 aaa(ib,3,4)", "width": "800" } 27 v>u return v (v=3) { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_27.jpg", "name": "v>u return v (v=3)", "description": "v>u return v (v=3)", "width": "800" } 28 加油 ~~!! 繼續做下去一定會是 以下結果 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_28.jpg", "name": "加油 ~~!! 繼續做下去一定會是 以下結果", "description": "加油 ~~!! 繼續做下去一定會是 以下結果", "width": "800" } 29 aaa(ib,0,9) 28 aaa(ib,0,4) u=8 aaa(ib,0,2) u=3 aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] aaa(ib,1,1) v=2 return ib[1] aaa(ib,2,2) v=3 return ib[2] aaa(ib,3,4) v=8 aaa(ib,3,3) u=6 return ib[3] aaa(ib,4,4) v=8 return ib[4] aaa(ib.5,9) v=28 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_29.jpg", "name": "aaa(ib,0,9) 28 aaa(ib,0,4) u=8 aaa(ib,0,2) u=3 aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] aaa(ib,1,1) v=2 return ib[1] aaa(ib,2,2) v=3 return ib[2] aaa(ib,3,4) v=8 aaa(ib,3,3) u=6 return ib[3] aaa(ib,4,4) v=8 return ib[4] aaa(ib.5,9) v=28", "description": "aaa(ib,0,9) 28 aaa(ib,0,4) u=8 aaa(ib,0,2) u=3 aaa(ib,0,1) u=2 aaa(ib,0,0) u=0 return ib[0] aaa(ib,1,1) v=2 return ib[1] aaa(ib,2,2) v=3 return ib[2] aaa(ib,3,4) v=8 aaa(ib,3,3) u=6 return ib[3] aaa(ib,4,4) v=8 return ib[4] aaa(ib.5,9) v=28", "width": "800" } 30 aaa(ib,0,9) 28 aaa(ib,0,4) u=8 aaa(ib.5,9) v=28 aaa(ib,5,7) u=28 aaa(ib,5,6) u=12 aaa(ib,5,5) u=6 return ib[5] aaa(ib,6,6) v=12 return ib[6] aaa(ib,6,7) v=28 aaa(ib,6,6) u=12 return ib[6] aaa(ib,7,7) v=28 return ib[7] aaa{ib,8,9) v=16 aaa(ib,8,8) u=16 return ib[8] Aaa(ib,9,9) v=11 return ib[9] { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3381818/slides/slide_30.jpg", "name": "aaa(ib,0,9) 28 aaa(ib,0,4) u=8 aaa(ib.5,9) v=28 aaa(ib,5,7) u=28 aaa(ib,5,6) u=12 aaa(ib,5,5) u=6 return ib[5] aaa(ib,6,6) v=12 return ib[6] aaa(ib,6,7) v=28 aaa(ib,6,6) u=12 return ib[6] aaa(ib,7,7) v=28 return ib[7] aaa{ib,8,9) v=16 aaa(ib,8,8) u=16 return ib[8] Aaa(ib,9,9) v=11 return ib[9]", "description": "aaa(ib,0,9) 28 aaa(ib,0,4) u=8 aaa(ib.5,9) v=28 aaa(ib,5,7) u=28 aaa(ib,5,6) u=12 aaa(ib,5,5) u=6 return ib[5] aaa(ib,6,6) v=12 return ib[6] aaa(ib,6,7) v=28 aaa(ib,6,6) u=12 return ib[6] aaa(ib,7,7) v=28 return ib[7] aaa{ib,8,9) v=16 aaa(ib,8,8) u=16 return ib[8] Aaa(ib,9,9) v=11 return ib[9]", "width": "800" }

Similar presentations