Linked List
Lab 13: Linked List
|
In this lab, you will write a program that manipulates Linked List.
· The execution of the finished program should look what is shown below (User input is shown in bold). Author: Hong Wang Lab: Thursday 2pm Program: Lab 13: Linked List
Available commands: insert <CHARACTER> <FREQUENCY> undo exit
Current linked list:
$ insert a 123
Current linked list: [a/123] $ insert b 2345
Current linked list: [b/2345] -> [a/123] $ insert x 777
Current linked list: [x/777] -> [b/2345] -> [a/123] $ undo
Current linked list: [b/2345] -> [a/123] $ undo
Current linked list: [a/123] $ insert x 999
Current linked list: [x/999] -> [a/123] $ exit
· The skeleton code is provided here: Lab13.cpp , you need to implement three functions. · DO NOT change any code within 'main' function.
· Stage 1 (1 point): · Implement function void displayList(Node* pHead), which display the entries in the list. Example: [x/777] -> [b/2345] -> [a/123]
· Stage 2 (1 point): · Implement function Node* addNode(Node* pHead, char c, int count), which · Creates a new node using given values · Inserts the new node at the beginning of linked list · Returns the new head pointer |