La Trobe University, Bendigo
FINAL EXAMINATION JUNE 2003
BITDST Data Structures
Examiner: Mary Martin Time Allowed: 3 hours _____________________________________________________________________
Instructions to Candidates:
1. Answer all questions.
2. Figures to the right indicate marks.
3. Make suitable assumptions where necessary.
4. Clearly state any assumptions made.
Question 1.
All parts of this question refer to Java code below.
import java.io.*;
import java.util.*;
/** Class EmployeeDetails: an employee description
** Date written: 2003-02-20
** @author Mild Mal <br>
** modified Milder Mary
** @version 2 created , 2003-09-21
**/
public class EmployeeDetails {
private String lName,fName, division, eNumber;
//constructors
EmployeeDetails(){}
EmployeeDetails(String lName,String fName,String division,String eNumber){
this.lName = lName;
this.fName = fName;
this.division = division;
this.eNumber = eNumber;
}
//get (accessor) methods
public String getName(){
return lName+Ó, Ň +fName;
}
public String getNumber(){
return eNumber;
}
public static EmployeeDetails createEmployee (String aLine)
String lName, fName, division, eNumber;
StringTokenizer tokens;
EmployeeDetails anEmployee = null;
if(aLine != null){
tokens = new StringTokenizer(aLine, ",");
if (tokens.countTokens()==4){
lName = tokens.nextToken();
fName = tokens.nextToken();
division = tokens.nextToken();
eNumber = tokens.nextToken();
anEmployee = new EmployeeDetails(lName, fName, division, eNumber);
}else
System.out.println("Incorrect number of details!!!!!!!");
}else
System.out.println("Data in incorrect Format!!!!!!!");
return anEmployee;
}
public String toString(){
return (fName + " "+lName+"\t"+division+"\t"+eNumber);
}
public static void main(String[] argv){
EmployeeDetails anEmployee = new EmployeeDetails("bok","joe","IT","5432");
System.out.println(anEmployee);
}
}
( 2 + 2 + 2 + 2 + 4 + 4 + 2 + 2 = 20 marks)
Question 2.
public class NodeType1{
double data;
NodeType1 next;
NodeType1(double d){
data = d;
}
}
public class NodeType2{
double data;
NodeType2 next;
NodeType2 prev;
NodeType2(double d){
data = d;
}
}
(2 + 3 + 2 + 3 + (6 + 4) = 20 marks)
Question 3.
10 50 20 30 65 5 60 15 55 35
(5 + 5 = 10 marks)
The data items listed below are to be used to answer the following parts to this question:
24 10 15 21 27 11 13 44 29
(2 + 5 + 5 + 5 + 1 + 2 = 20 marks)
For the binary search tree given below:

Using diagrams and text description, show each step which must be taken, and the final tree for the following deletions (NB: start with the original tree for each deletion):
i) delete node S
ii) delete node G
iii) delete node N
(3 + 3 + 4 = 10 marks)
Using Java or pseudocode develop a class called StudentRec to represent a student by listing the data (instance variables) required to represent the student and the methods it must have to provide access to the data. The student's details to be stored are: student name, student number, home town and URL of the studentŐs image. (For each instance variable and method make sure you include the proposed name, datatype and a short description of its purpose.)
The university wishes to maintain a student database which will provide:
The student details are stored in a text file which is read by the program when it starts and written when the program exits. The user interface to the program is graphical (GUI).
Using the Object-Oriented Approach, carry out an initial analysis and identify the major objects necessary for the application to be developed. For each object you identify, suggest a name and give a short description of its purpose.
( 5 + 5 = 10 marks)