所屬科目:研究所、轉學考(插大)◆資料結構與演算法
2. Which of the following statemnents about n-element AVL trees are false? (A) The time complexity of deleting element with key k is O(1). (B) The time complexity of insertion is O(log n). (C) If the AVL tree has height = h, then n >=, where Fittl is the Fibonacci numbet, i e.,(D)hL - bR should be O, where hi, and hr denote the height of the left subtree and the right subtree, respectively.
4. Which of the following statements are true? (A) In general, a recursive version is less efficient in terms of time and space than a non-recursive version. (B) The function F1 below is executable (i.e., terminable) for all positive integer x. (C) When input data are 21 and 12, the output of function F2 is 4, i.e., F2(21, 12)-4. Int F2(int x, int y) (D)When input data is 5, the output of function F3 is 5, ie, F3(S) -5.
9. The pseudo code below aims to reverse a linked list. Which of the following statements are true? (A) Blank (1) should be C != NULL. (B) Statement C->next = P; reverses node's pointer. (C) Blank (2) should be*Href= C; (D) Statement P = C; moves the pointer to the next.
10. The adjacency list below is for an AOE network. The end field points to a list of adjacent vertices, dur field is the duration of the activity, link field points to another adjacent vertex, vertex field is the id of the adjacent vertex, count filed is the number of immediate predecessors. Which of the following statements are true? (A) The total duration of the critical path is 18. (B) Path 0, 1, 4, 6, 8 is not a critical path. (C) Path 0, 2, 4, 7, 8 is a critical path. (D) The latest time that event 4 (i.e., vertex 4) can occur is 8.
(A) (15%) Assume that By the assumptions and above definition and theorem, prove that D is NP-complete.
(B) (13%) Now you a are given a a weighted graph G-(V, E), a specified vertex s in V, an array d ] of size V, and it is claimed that for each v in Y, dty is the length of the shortest path from s to v. The claim may be correct or may be not. Design a linear time algorithm to check whether the claim is correct. Analyses the time complexity of your algorithm and make sure it is linear, that is, the running time of your algorithm must be O(|V|+|E|).