题目内容

9 For a given n elements, there are () kinds of logical structures that can be constructed.

A. 3
B. 4
C. 5
D. 6

查看答案
更多问题

10 In the following program segment, the sentence frequency of x = x + 1; is (). for( i=1;i<=n;i++) for( j=1;j<=n;j++) x=x+1;

A. O(2n)
B. O(n)
C. O(n^2)
D. O(log2n)

11 The time complexity of the following function sum (n) is ( ). sum (int n) { int sum=0; for(i=1;i<=n;i++) { p=1; for(j=1;j<=i;j++) p*=j; sum+=p; } return(sum); }

A. O(2n)
B. O(n)
C. O(n^2)
D. O(log2n)

12 There is the following recursive function fact (n), whose time complexity is( ). int fact (int n) { if(n<=1) return 1; else return(n*fact(n-1)); }

A. O(2n)
B. O(n)
C. O(n^2)
D. O(log2n)

13 After the following statement segment is executed, the value of i is () int f(int x) { return ((x>0) ? x* f(x-1):2); } int i ; i =f(f(1));

A. 2
B. 4
C. 8
D. Infinite recursion

答案查题题库