所屬科目:研究所、轉學考(插大)-資料結構
(2) Consider the following binary tree. After the execution of function unknown(r), what is the value of the data of the rightmost node?(A) 7 (B) 6 (C) 3 (D) 2 (E) None of the above.
(31) Consider the following algorithm. Algorithm Sort(A, n) Input: Array A containing n different integer values. Out: Array A sorted in increasing order of values. Which of the following instructions must be inserted at the point marked (*) so that the algorithm correctly sorts the values stored in A in increasing order of values? (A) for j ← 0 to n - 1 do if A[j] > A[m] then m ← j (B) for j ← i+1 to n - 1 do if A[j] > A[m] then m ← j (C) for j ← 0 to i - 1 do if A[j] > A[m] then m ← j (D) for j← i+ 1 to n -1 do if A[j] < A[m] then m ← j (E) for j ← O to n -1 do if A[j] < A[m] then m ← j
(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) {