| December
    1999 QUESTION 1 (Compulsory) Total Marks: 30 Marks | Click here to access 
          other questions Click to access | 
| (a) | Briefly explain the main characteristics of the following terms: (i)Binary trees [1 mark ] (ii)N-ary trees [1 mark ] (iii)FIFO queues [1 mark ] (iv)LIFO queues [1 mark ] 
 | [4] | 
| (b) | In terms of lookup and update times, briefly identify the differences between arrays and dynamic linked lists . 
 | [2] | 
| (c) | (i)Explain, informally, how a bubble sort works.[3 marks ] (ii)Explain, informally, how hashing works.[3 marks ] (iii)Briefly identify the most common problem with hashing.[1 mark ] 
 | [7] | 
| (d) | (i)Write an iterative function, called Remainder , the signature of which is given below, which takes in two integer parameters by value and returns the remainder of x /y .You may not use any library functions.[3 marks ] 
 (ii)Write an iterative function, called 
            IsPrime , the signature of which is given below, which takes an integer 
            parameter by value and returns TRUE if the parameter is prime and 
            FALSE otherwise. Note that an integer N (for N FUNCTION IsPrime(x: INTEGER): BOOLEAN; 
 | [7] | 
| (e) | Assume the following definition of a double linked list,together with the signature of the procedure Remove ,which removes from the list x the item pointed to by y : 
 
 (i)Write a recursive function, called Search , the signature of which is given below. This function takes in two parameters by value, the first of which is a double linked list, and the second being an integer, and returns either a pointer to the first occurrence of the integer in the list or a NULL pointer if the integer is not in the list.[5 marks ] 
 
 | [10] |