CS3810 Data Structures and Algorithms Fall 2016 Assignment 3
Added on - Sep 2019
Showing pages 1 to 1 of 2 pages
CS3810 Data Structures and AlgorithmsFall 2016Assignment 3 (Linked List and its applications):Assign Date: 11/2/16Due Date: 11/21/16Programming:A department needs to manipulate student records. The basic operations includeadd,remove,searchanddisplaythe records. This system is implemented by usingadoubly linked circular list. See the detail requirements for the implementation.Detail Requirements:The system will be implemented by adoubly circular linked list. The followingclasses should be created in this system.1.Studentclass - contains two class fields and several methods:name - The first and last names are in one stringid – It is a random number generated when inserting the object into thelist. It must be aunique number.set/get methodstoString() method to allow displaying the content of an object. Organizethe data properly for displaying.2.Nodeclass – represents a node in the list. The data part containsone objectofStudentclass. The link part containstwo links,nextandprev.3.CircularListclass – represents a doubly linkedcircular list. It is defined as follow:1)The class has two instance variables only:cursor(Nodetype) - always point to the current element in the list[Note: There are no ‘first’ and ‘last’ references in the list and youshould not define another pointer ‘current’ in any cases. The ‘cursor’is the ‘current’.]size(int type) – the number of elements in the list2)The list is doubly linked and unordered.3)The list has no head and no tail.4)The cursor isnullif the list is empty.5)If the list contains only one elemente1, thecursorrefers toe1, and thenextandtheprevofe1point toe1itself.6)If the list contains two elementse1ande2, thenextandpreviousofe1point toe2,and thenextandpreviousofe2point toe1(means they point to each other).7)The operations (methods) of the class are:voidadd(Node newNode)– add a new element after the node pointed bythe currentcursor.The newNode has to be unique (by testing the id).Noderemove(int key)– remove the element in which theidof the objectmatches the given key. The method returns null if the key is not found;otherwise it returns the node of the removed element.