所屬科目:研究所、轉學考(插大)、學士後-計算機概論
4. Determine the tightest big-O complexity of the recurrence:(A) O(1) (B) O(n) (C) O(nlogn) (D)O(n2) (E) O(n3)
7. What is the output of the following program? (A) 101 102 34 (B) 101 21034 (C) 1 102 1034 (D) 1 1023 104 (E) 12103 104
18. Please sort the following functions in descending order of their growth rate. (A)y>z>x>w (B) z>y>w>x (C) z>y>x>w (D)y>z>w>x (E) x>y>z>w
22. For the following function foo, which statement is true? (A) If n>1, the returned value of function foo must be even. (B) The time complexity of function foo is O(n?). (C) For any integer n>=1, function foo calculates the value of 2-1 i. (D) The value returned by foo(2.8) is 3. (E) All the above statements are true.
39. Binary search tree (BST) stores keys in its nodes. Which of the following statements are true? (A) For a binary search tree with n nodes, searching a key in BST takes O(log n) time in worst case. (B) A binary search tree of height h has at most nodes. (C) Performing an inorder traversal on a binary search tree results in a sorted list of keys in ascending order. ' (D) AVL trees are also binary search trees. (E) Given the preorder and inorder traversal sequences of a BST, we can re- construct a unique BST.
40. Which of the following statements is NOT true? (A) Dijkstra algorithm cannot correctly calculate the shortest paths if there exist negative edge weights in the graph. (B) Bellman-Ford algorithm can detect negative cycles in a graph. (C) Given an unweighted graph with a node v, employing Breadth-First Search (BFS) starting on v obtains the single-source shortest paths with source node v. (D) Floyd-Warshall algorithm for finding all-pair shortest paths works for graph with negative edge weights (but with no negative cycles). (E) The worst-case time and space complexities of the Floyd-Warshall algorithm are both θ(n3).