[請益]請大家幫個忙....

看板NTUIM-14作者 (哇..瘋狂大採購)時間19年前 (2005/04/13 22:42), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
1. [台大資管93] int f(int n) { if(n<=1) return 1; else return f(n-1)*f(n-2)+f(n-1); } The output of f(5) is _______ 2. [台大資管92] What function does the following C program perform? void guessme(char s[], char t[]) { int x=0; while(s[x++]=t[x]); } The answer is: ___________________________ 3. [台大資工92] Determine the computational complexity of the following two loops: (a) for (i=0; i<n; i++) for (j=0; j<n; j++) a[i][j]=b[i][j]+c[i][j]; // How many times does this statement be executed? (b) for (i=0; i<n; i++) for (j=0; j<n; j++) for (k=a[i][j]=0; k<n; k++) a[i][j]+=b[i][k]*c[k][j]; // How many times does this statement be executed? (a) _______________ (b) _______________ 4. [東華資科轉學91] List the results of the two programs and explain why both answers are different? (a) main() { increment(); increment(); increment(); } increment() { int x=0; printf("%d\n", x++); } (b) main() { increment(); increment(); increment(); } increment() { static int x=0; printf("%d\n", x++); } (a) _______________ (b) _______________ Why? 5. [台大資工91] Given the following three tree traversal combinations, tell which combination results in a unique binary tree. If it corresponds to a unique binary tree, show the tree and list the level order traversal. Otherwise, explain why more than one binary tree is produced, or there does not exist such a binary tree. (Hint: pre/in/post-order is identical to pre/in/post-fix) (a) preorder: J C B A D E F I G N inorder: A B C E D F J G I H (b) preorder: A B D G C E H I F postorder: G D B H I E F C A (c) postorder: F E C H G D B A inorder: F C E A B H D G (Hint: if preorder:+ A B and inorder A + B then the answer is the tree as shown in Fig. 1) 6. [中央資工93]Using C language, write a recursive function recursiveMinimum that takes an integer array and the array size as arguments and returns the element with the smallest value in the array. The function should stop processing and return to its caller if it receives a one-element array. 7. Write a recursive function, such as int fib(int n), to calculate f(n)=f(n-1)+f(n-2), for n>2, and f(1)=1, f(2)=1. 請台大資管的各位幫個忙.......這個很急 希望能幫我解一下題目....謝謝各位的幫忙 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 163.25.118.13

140.112.240.177 04/14, , 1F
第一個是60嗎?@@
140.112.240.177 04/14, 1F
文章代碼(AID): #12NI_9mT (NTUIM-14)