Essential Algorithms (CS2EA16) Coursework(2016/17) • Please upload your work as a single file, via blackboard before 12:00 noon, Monday, 23, January,2017. • This coursework (worth 30% of the module mark), consists of three parts: (1) Part A (30%) are short answer questions; Assessment is based on the correctness of the answers. (2) Part B (20%) are multiple choices questions; Assessment is based on the correctness of the answers. (3) Part C(50%) are two implementations. Assessment is based on: (≥ 70%): Correctly implement, and clearly report with good analysis to the results; (50%-69%): Reasonable/good implementation, and reasonable/good report with some analysis to the results; (40%-49%): Evidence of attempts and report with little results/analysis; (0%-39%) : Little or no evidence of attempts and poor report. 1 2 Part A: Give a short answer to the following (one mark each question): (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15) (16) (17) (18) (19) (20) (21) (22) (23) (24) (25) (26) (27) (28) (29) (30) What is a minimum spanning tree? Define the data structure heap. What is a convex hull of a set of points? Name two types of minimum spanning tree algorithms? Give two examples of divide and conquer (D&C) algorithms. Give two examples of greedy algorithms. Give two example of dynamic programming algorithms. What is the usefulness of the Master theorem? What is the recurrence relation in Master theorem? Name two types of traversal techniques for graphs. Name two types of representations for graphs. Describe the general idea of divide and conquer. What are the benefits of control abstraction? What is the main difference between dynamic programming and greed algorithms? What is a selection algorithm? Name three types of binary traversal techniques. What is the key difference between Dijkstra’s algorithm and Floyds Allpairs shortest path algorithm? What is a string edit problem? What are two ways of building a heap? Why is Strassen matrix multiplication method faster than a standard matrix multiplication algorithm? What are the steps in a D&C max-min algorithm? State the fractional Knapsack problem. Briefly explain how recursion can be used in binary D&C matrix multiplication. Why M akeHeap and F ixHeap can be combined as the sorting method Heapsort? What is a weighted graph? What is a connected graph? State the traveling salesman problem. What is the transitive closure of a directed graph? What are functions F easible and U nion in control abstract for Greedy algorithm? State the principle of optimality in dynamic programming. 3 Part B: Multiple choices questions (two marks each question): (1) Every node in a (min) binary heap A: B: C: D: Has two children Is no larger than its children Is no smaller than its children Has a smaller left child than right child (2) When inorder traversing a binary tree resulted E A C K F H D B G; the preorder traversal would return A: B: C: D: FAEKCDBHG FAEKCDHGB EAFKHDCBG FEAKDCHBG (3) The computational time complexities of the three algorithms of Heapsort, D&Cmax − min, Strassen′ s matrix multiplication, are respectively A: B: C: D: O(n log n), O(n2.81 ) and O(n) O(n2.81 ), O(n) and O(n log n) O(n log n), O(n) and O(n2.81 ) O(n2.81 ), O(n log n) and O(n) (4) The partition algorithm is applied to list [5, 6, 7, 1, 2, 10, 20], with the first element as pivot. It would return A: B: C: D: [5, 6, 7, 1, 2, 10, 20] [1, 2, 5, 6, 7, 10, 20] [6, 7, 5, 1, 2, 10, 20] [6, 7, 1, 2, 5, 10, 20] (5) Consider recursion T (n) = 2T (n/2) + n, the critical component and the time complexity are A: B: C: D: c = 1, T (n) = O(n log(n)) c = 2, T (n) = O(n2.81 ) c = 1, T (n) = O(n2 ) c = 2, T (n) = O(n3 ) (6) Consider recursion T (n) = 7T (n/2) + 18n2 , the critical component and the time complexity are A: B: C: D: c = 2.81, T (n) = O(n3 ) c = 2, T (n) = O(n2.81 log n) c = 2.81, T (n) = O(n2.81 ) c = 2.81, T (n) = O(n3 ) (7) Assuming T (1) = 2, solving the recurrence equation T (n) = 2T (n/2) + n would return A: B: C: D: n log n + 2n 2n n log n None of the above. (8) Consider the graph below. Which of the statement is true A: The graph is not strongly connected. 4 0 ∞ 3 ∞ 2 0 ∞ ∞ B: It has a matrix representation of ∞ 7 0 1 6 ∞ ∞ 0 0 ∞ 3 ∞ 2 0 ∞ ∞ C: The distance matrix of the graph is ∞ 7 0 1 6 ∞ ∞ 0 0 10 3 4 2 0 5 6 D: It has a matrix representation of 7 7 0 1 6 16 9 0 (9) Consider the following graph. Which one of the following is a valid ordering of the vertices if the graph is traversed using breadth first search (BFS), starting from vertex ‘b’ ? A: B: C: D: b,f,e,c,g b,c,g,f,e b,c,f,g,e b,f,g,c,e (10) For the same graph in (9), and also starting from vertex ‘b’, which one of the following is a valid ordering of the vertices if the graph is traversed using breadth first search (DFS)? A: B: C: D: b,f,c,e,g b,c,f,e,g b,f,e,c,g b,c,g,f,e 5 Part C: Implement a program of path planning using D&C convex hull algorithm, in any programming language of your choice (1) A common problem in Robotics is to identify a trajectory from a start point A to a destination point B as shown in figure below. The Robots sensors indicate that there is an obstacle. Construct the convex hull consisting of the points A, B and the vertices of the polygon P (assume any arbitrary point set for the polygon with perhaps 15 points). [30 marks] (2) Extend the program in (1) to handle multiple obstacles as shown in Figure b) below with the start point A going through B and destination C. [20 marks]
© Copyright 2026 Paperzz