(35) Consider the following C++ function that uses a divide and conquer approach to calculate the sum of a range of numbers. Which of the following lines of code from the above function divides this problem into sub-problems?
(A) int result = sum(i, mid) + sum(mid+1, j);
(B) int mid = (i+j)/ 2;
(C) if(i==j){
(D) return result;
(E) int sum(int i, int j) {

答案:登入後查看
統計: 尚無統計資料

詳解 (共 1 筆)

#7101506
題目解析 這道題目考察的是「分治法」(...
(共 954 字,隱藏中)
前往觀看
0
0