advertisement

06-19323 Fundamentals of Computer Science (Part 1: Data Structures) Supplementary Examination Paper 2008 (Answer any THREE questions) QUESTION 1 (a) Describe what you understand by abstraction, levels of abstraction and representation. [6%] (b) Give two possible levels of abstraction for each of the following: i) a city’s railway station ii) your personal DVD and CD collection iii) spectators at the Wimbledon men’s tennis final [9%] (c) State three features necessary in a programming language to support data abstraction. [3%] QUESTION 2 (a) Composite data types may be constructed from combinations of the four fundamentals data types: sets, lists, trees and graphs. e.g. a list of list data types. Give one example for each of the following: (i) (ii) (iii) (iv) (v) A set with components which are sets. A list with components which are sets. A list where each component is a tree. A tree with nodes which are lists. A list with components which are graphs. [13%] (b) A list data type may be represented and implemented in Java using an array data type 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. [4%] QUESTION 3 (a) Give ONE reason why supporting a Set Data Type is difficult in programming languages. [2%] (b) A Hash table with internal chaining has been chosen to store the following list of words interrupt, pixel, protected, graph, reality, palette, reflection, re-order, pointer, frame, font, text Using the alphabetic position of the first letter of each word as its Hashed address i.e. a Hashes to 1, b Hashes to 2 etc., construct diagrams with explanation where necessary, to show the Hash table after inserting the above words, in the order they are listed. [10%] (c) Suppose the words 're-order' and 'protected' are deleted from the Hash table you constructed in part (b) above. Use a diagram to show the resulting table. [4%] (d) How may the efficiency of access to an internally chained Hash table be improved? [1%] QUESTION 4 (a) (i) Construct and draw a binary search tree (BST) from the following strict sequence of integers 8, 4, 12, 8, 16, 4, 18, 12, 14 [4%] (ii) State, giving reasons, whether or not the tree you have grown in answering (i) above is a height balanced (AVL) tree. [3%] (b) (i) Describe briefly how the integer 34 might be inserted into the following AVL tree to maintain its properties: 30 19 36 32 40 Draw the resulting AVL tree. [6%] (ii) State one disadvantage and one disadvantage of AVL trees [4%] Fundamentals of Computer Science 1: Data Structures/Algorithms Questions to Learning Outcomes Question 1 – Learning Outcomes Refs – 1, 2 Question 2 – Learning Outcomes Refs – 1, 2, 3 Question 3 – Learning Outcomes Refs – 1, 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, logarithmic). The above Learning Outcomes were distributed to the students at the beginning of the Module and during the revision lectures