Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
06-21921 Fundamentals: Data Structures & Algorithms Supplementary Examination Paper 2012 (Answer any THREE questions) QUESTION 1 (a) Define data type and abstract data type. [8%] (b) Abstract data types may be created from combinations of sets, lists, trees and graph data types e.g. a set of objects each of which is a set. Suggest one or more abstract data types for each of the following (i) (ii) (iii) (iv) (v) several shipping crates for various artifacts the seating arrangement in a concert hall 64 tennis players competing in a club knock-out tournament tourist guides to several regions and cities in the UK the campus map of The University of Birmingham [25%] QUESTION 2 (a) Composite data types are constructed from components of the four fundamental data types: sets, lists, trees and graphs. e.g. set of sets. Give one real world example for each of the following: (i) (ii) (iii) (iv) (v) A set with components which are sets. A list with components which are a set. A list with components which are a tree. A tree with components which are lists. A list with components which are graphs. [25%] (b) A list data type may be represented and implemented in Java using an array or using object references to create a linked structure. State one advantage and one disadvantage for each of these mechanisms for implementing a list data type. [8%] QUESTION 3 (a) Construct a Binary Search Tree from the following strict sequence of integer values – 16, 10, 12, 8, 6, 11, 14, 20, 31, 9, 18, 19, 46, 17, 13 (10%) (b) Draw the tree you constructed in part (a) after deleting node 16. Outline your deleting procedure. (10%) (c) The delete operation on a BST can be achieved by moving entire sub trees as the following illustrates Deleting node D in the tree below D B is rearranged to B A C E A E C Apply this procedure to delete node 20 in the BST you constructed in part (a) above. (13%) QUESTION 4 (a) (i) Construct and draw a binary search tree (BST) from the following strict sequence of integers 8, 4, 12, 16, 18, 8, 14, 4 [6%] (ii) State, giving reasons, whether or not the tree you have grown in answering (i) above is a height balanced (AVL) tree. [9%] (b) (i) Describe briefly how the integer 23 might be inserted into the following AVL tree to maintain its property as an AVL Tree: 25 21 20 29 22 Draw the resulting AVL tree. [12%] (ii) State one advantage and one disadvantage of AVL trees [6%] Fundamentals of Computer Science 1: Data Structures/Algorithms Questions to Learning Outcomes Question 1 – Learning Outcomes Refs – 1, 2 Question 2– Learning Outcomes Refs – 2, 3 Question 3 – Learning Outcomes Refs – 1, 2, 3 Question 4 – Learning Outcomes Refs – 1, 4, 5 Learning Outcomes Ref 1 2 3 4 5 N.B. Objective, Learning Outcome Understand the internal representation of basic data structures (linear and non-linear lists) and associated algorithms as well as hash tables (implementation for sets). Judge the suitability of a particular type of data type for a given application. Select appropriate internal data structures to ensure efficient searching, insertion and deletion of data types Understand how to build binary trees, heaps, graphs together with their internal representations and relevant algorithms. Appreciate differences between basic complexity classes of algorithms (constant, linear, quadratic and logarithmic). The above Learning Outcomes were distributed to the students at the beginning of the Module and during the revision lectures