Task 3 : Double Linked List
- FORK this repositori ASD_Task_3 to your GitHub account
- CLONE ASD_Task_3 repository from YOUR OWN ACCOUNT
- open and modify codes in *.cpp and *.h files inside project ASD_Task_3
- write your code inside the provided space in each functions/procedures
- COMMIT and PUSH your project to your account
- create a Pull Request
Create a program to store and manage a data using double linear linked list
TODO: create a new Data type with specification: - an integer variable acted as an ID - string name - integer rank - float score
mytype create_data()
TODO: receive input from user and assign the value of new dataview_data(mytype d)
TODO: view the content of data dedit_data(mytype &d)
TODO: edit the value of data d, the ID must not be modified
You may just copy your previous result
Create ADT of double linked list
-
define a function and a procedure to allocate and deallocate an element list
function allocate(in: x : infotype) : address
procedure deallocate( i/o: P : address )
-
define insert and delete procedure
procedure insertFirst( i/o: L : List, i: P : address )
procedure insertLast( i/o: L : List, i: P : address )
procedure insertAfter(i/o: L : List, i: Prec : address, P : address )
procedure deleteFirst( i/o: L : List, i/o: P : address )
procedure deleteLast( i/o: L : List, i/o: P : address )
procedure deleteAfter(i/o: L : List, i: Prec : address, i/o: P : address )
-
define search-by-ID function and view procedure
function findElm( i: L : List, x : infotype ) : address
procedure viewList( i: L : List )
- define insertion procedure
procedure insertAndSort( i: L : List, x : infotype )
TODO: insert a new element into an already sorted-by-ID List L,
so that the elements inside List L is still sorted by ID
procedure must also check if such ID is already exists (No Duplicate ID)
If new data has duplicate ID, new data is rejected.
- define deletebyID function
procedure deletebyID( i/o : L : List, x_id : integer )
TODO: delete an element in List based on it's ID
- define savePassedMember procedure
savePassedMember( i/o: L : List, L2 : List )
TODO: move any element from List L that has score greater than 80 into List L2
Implement function and procedure defined in list.h
Implement function and procedure defined in operation.h
Create a main menu to run your application
Menu Application:
- insert new data
- print all data
- find and print a data (search by ID)
- edit data by ID
- delete data by ID
- exit
ID is unique, check whether ID is already exsits when inserting new element