|
Assignment 2
Part A
The Student Registration System that you have developed for Project2 should be modified such that as a data structure instead of a Linear Linked List you should employ a Binary Tree. Organize your code such that the same application level code can be used without any modification. In other words the application programmer should not be aware of the modification of the underlying data structure. Note that now only one Student List (kept sorted w.r.t idno) is required. All the requirements are exacly the same as in Project 2 except the ps command. Remember that an inorder traversal of the Btree will give you a sorted list. Deleting a node is tricky. See the details at the book by Dale. In addition to the recursive InorderTraversal function also provide a non-recursive version.
Part B
Overload the createStudentList() function such that it creates a student list of synthetic records. For this purpose, write two non-member functions: one to generate a random string of a given size, the other to generate a random Student record. In synthetic records, for Idno a string of 5 numerals is enough. For Surname generate 3 alphabeticals and add "SURNAME", for name use the same 3 alphabeticals then add "NAME". Dept can be constant for all. The application should look like the following:
int main(){
StudentList cmpe160;
createStudentList(cmpe160,nofStudents);
editStudentList(cmpe160);
return 0;
}
Experimentation: Construct a list of 10000 records. Search for a particular student record in the list and time it. You can add a command s for this purpose. Compare the timings you get for Linked List and BTree implementations. Also compare list construction times. Write your findings in a README file.
s<enter>: search Student
enter idno:
|