作者rever (哇..疯狂大采购)
看板NTUIM-14
标题[请益]请大家帮个忙....
时间Wed Apr 13 22:44:24 2005
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
1F:推 fifth:第一个是60吗?@@140.112.240.177 04/14