Professional Documents
Culture Documents
1. The code in StringLinkedList folder is the “singly linked list of strings” class in your textbox
P.118 add the following function to the class and test them:
a. print() : prints the whole list.
b. addLast(e) : insert a new Node contains string e at the end of the list.
c. removeLast() : Remove last element in the list.
d. count() : returns the count of nodes in the list.
2. The code in DLinkedList folder is the doubly linked list class in your textbox P.126.
a) Convert it to a generic class (use template).
b) Add a count function that returns the number of nodes insides the linked list
c) add a [] operator to retrieve the data stored in the linked list.
d) Update [] operator such that a negative index means counting from last item to first one
(-1 last one, -2 the one before the last, …)
e) a function called removeAt that takes an index and remove the Node of that index.
Don’t add any new member data or other functions to the class.
3. Using the previousDLinkedList, write a main function that reads from the user as many
GameEntrys (class in P.104 and found in GameEntry folder) as he wishes then prints them
from first entry to last and from last entry to first.
Update the main to allow the user; after printing, to remove from the list as many
GameEntrys he wants then prints the list again.
4. Implement a sortedLinkedList class that insert the data into a linkedList in descending order.
The class should have a function to check the existence of a data in the sortedLinkedList and
also a function to remove a data (searching by its value not index) from the linkedList
7. Implement a priorityQueue class that stores the data and their priority. The stored data
should be arranged in a ascending order from lowest priority to the highest one.