NUIMCrest CS211 - Algorithms and Data Structures II
Department of Computer Science, NUIM
Laboratory Sheet 11

For week beginning Monday 24 April 2000
T Naughton, NUIM
Back to CS211 home


Lab Exam 11

  • Provide solutions to problems 11.1 and 11.2.
  • No books, notes, computers allowed.
  • Use the paper provided by demonstrators.
  • You have 60 minutes.
  • Write your name below.

    Name:......................................................................... Student No:...................................

    Important: Write clearly. If necessary write out a neat and formatted version of your code separate from your rough-work.

    Problem 11.1 Write a method for an ordered binary tree that returns the path from the root to each leaf node. For example, a tree with the following structure (where the root is 5),
         9
       8<
         6
    5<
         4
       3/
    would have the following paths,
    right,right,9
    right,left,6
    left,right,4

    Problem 11.2 A class to implement a hash table of student id.s is required. The student id. (the key) is stored as type verylongint and each student's name and address are stored as character strings. Write the definition for the class (referring to all data structures and suitable methods), and write the code for the remove() method. Finally, answer the following question: Why would we use a hash table in this instance and not a static array or linked list?


    End of Lab Sheet