Question: Linked List Implementation Write a console application that keeps track of names (strings) in a list. -- Include a class called: LinkedList -- Utilize a
Linked List Implementation
Write a console application that keeps track of names (strings) in a list.
-- Include a class called: LinkedList
-- Utilize a struct called: Node
Since it is a class, create separate .h and .cpp files for LinkedList. Node can be embedded inside the LinkedList files (no programs using the LinkedList class would need to know about the Node or see an interface to it). You can implement Node in its own file.
Youll need to write a main and some additional functions to implement the user interface. All menu/error output should occur in this code; the only output done in LinkedList will be streaming the items in the list to "cout" in the print and/or printReverse methods (see details below).
Notes:
-- Do not use any templates from the Standard Template Library.
-- The user interface (including main()) should be in a separate source (.cpp) file.
Details:
The linked list class should support the following methods (public member functions):
-- insert - inserts the given item in the list (in alphabetical order) if its not already there (no duplicates). Returns true if successful.
-- remove - removes the given item from the list. Returns true if successful.
-- print - prints the list in order
-- count - returns a count of the number of items in the list using recursion (no loops allowed)
-- removeAll - removes all items from the list
-- printReverse - prints the list in reverse order using recursion (no loops allowed)
The linked list should store a list of strings in alphabetical order. Duplicates are not allowed.
Do display a menu to the user consisting of the following options:
a - Add an item
r - Remove an item
d - Remove all items from the list
Additional details:
-- Your LinkedList class should have a constructor and destructor (destructor should delete every node)
-- If an item is to be added or removed, prompt for the item name to be added or deleted (spaces should be allowed)
-- After each operation:
-- give the user feedback as to whether the operation was successful or not
-- re-display the list
-- redisplay the menu of user options
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
