Question: This section has been set as optional by your instructor. In this lab we will write code for working with a Linked List. Node class
This section has been set as optional by your instructor. In this lab we will write code for working with a Linked List. Node class represents a single element of the linked list. class Node { public: Node(); Node* prev; string key; Node* next; }; LinkedList class represent one entire linked list. class LinkedList { public: LinkedList(); void Insert(string key); // Adds new node to head of list. void Print(); // Prints list Node* Find(string key); // Returns pointer to node with key equal to parameter key. void Delete(Node* x); Node* head; }; Code to insert strings into linked list. while (true){ getline(cin, line); if (line.empty()){ break; } l.Insert(line); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
