Part 1: Use this Project: Project Code
Extend the class linkedListType by adding the following operations :
- Find and delete the node with the smallest info in the list. (Delete only the first occurrence and traverse the list only once.)
- Find and delete all occurrences of a given info from the list. (Traverse the list only once.)
- Write a function that returns the info of the kth element of the linked list. If no such element exists, terminate the program.
- Write a function that deletes the kth element of the linked list. If no such element exists, output an appropriate message. Provide the definitions of these functions in the class
linkedListType. - Extend the class
linkedListTypeby adding the following function:void rotate();
//Function to remove the first node of a linked list and put it
//at the end of the linked list. - Modify the Test code to test all these functions using the
unorderedLinkedListclass.
Add these as abstract functions in the class linkedListType and provide the definitions of these functions in the class unorderedLinkedList.
Part 2: Github: Project code:
Here is the orderlist template code: Link
Add the following operation to the class orderedLinkedList:
void mergeLists(orderedLinkedList<Type> &list1,
orderedLinkedList<Type> &list2);
//This function creates a new list by merging the
//elements of list1 and list2.
//Postcondition: first points to the merged list; list1
// and list2 are emptyCode language: JavaScript (javascript)
Example: Consider the following statements:
orderedLinkedList<int> newList;
orderedLinkedList<int> list1;
orderedLinkedList<int> list2;Code language: HTML, XML (xml)
Suppose list1 points to the list with the elements 2 6 7 and list2 points to the list with the elements 3 5 8. The statement:
newList.mergeLists(list1, list2);Code language: CSS (css)
creates a new linked list with the elements in the order 2 3 5 6 7 8 and
the object newList points to this list. Also, after the preceding statement
executes, list1 and list2 are empty.
Write the definition of the function template mergeLists to implement the operation mergeLists. Also write a more code to test your function.
Grading
| Requirements | Grading Comments | Points | Score |
|---|---|---|---|
| Good Code Design Part 1 | 15 | ||
| All operations work as specified | 20 | ||
| Complete Test Code Part 1 | 15 | ||
| Good Code Design Part 2 | 15 | ||
| Part 2 merges correctly | 20 | ||
| Complete Test code Part2 | 15 | ||
| Total | 100 |
Teams:
LLab5-Pair-01: Shadia Amado-Aguad, Sariyah Sintayehu
Lab5-Pair-02: Davelle Ampofotwumasi, Luke Galik
Lab5-Pair-03: Nora Archer, Peter Dunson
Lab5-Pair-04: Moe Belghith, Yaw Oppongkrampah
Lab5-Pair-05: Eden Cohen, Trang Nguyen
Lab5-Pair-06: Calvin Deka, Ella Rigoli
Lab5-Pair-07: Djordje Dragojlovic, Leo Xie
Lab5-Pair-08: Westley (Kelly) Kailus, Joey (Jiayin) Liu
Lab5-Pair-09: Khanh Mai, Hoan Nguyen
Lab5-Pair-10: Cloris (Zongyu) Liu, Danny Vasconez
Lab5-Pair-11: Lucas Waite
Lab5-Solo-12: Adam Khan
Lab5-Solo-13: Kuba Kopczuk
