TRICTLY USE TEMPLATE PROVIDE AT END OF QUESTION IN YOUR SOLUTION ---------------------------------------- Write a C++ program to implement insertion, deletion, and display operations in a Linked List Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. The class Node has the following member variable Datatype Variable  Usage int data to store data Node* next to store the next node Define the following public member functions in the class LinkedList. Member function Function description void insertNode(int value) This function inserts the data into the linked list at the end void deleteNode(int value) This function deletes the node from the linked list void display() This function is used to display the nodes in the linked list   In the main() function, read inputs and call the functions of the LinkedList class based on the inputs. Note:  If the Linked list is empty while displaying,  then print "List is empty" in the display() function.   Input and Output Format: Refer to sample input and output for formatting specifications. [All text in bold corresponds to input and the rest corresponds to output.] Sample Input and Output 1: 1.Insertion 2.Deletion 3.Display 4.Exit Enter your choice : 1 Enter the element to be inserted : 10 Element 10 is inserted into the Linked list 1.Insertion 2.Deletion 3.Display 4.Exit Enter your choice : 1 Enter the element to be inserted : 3 Element 3 is inserted into the Linked list 1.Insertion 2.Deletion 3.Display 4.Exit Enter your choice : 1 Enter the element to be inserted : 2 Element 2 is inserted into the Linked list 1.Insertion 2.Deletion 3.Display 4.Exit Enter your choice : 3 10 3 2  1.Insertion 2.Deletion 3.Display 4.Exit Enter your choice : 2 Enter the element to be deleted : 3 Element 3 is deleted from Linked list 1.Insertion 2.Deletion 3.Display 4.Exit Enter your choice : 3 10 2  1.Insertion 2.Deletion 3.Display 4.Exit Enter your choice : 4 Sample Input and Output 2: 1.Insertion 2.Deletion 3.Display 4.Exit Enter your choice : 3 List is empty 1.Insertion 2.Deletion 3.Display 4.Exit Enter your choice : 4   ---------------------ONY USE BELOW TEMPLATE IN YOUR SOLUTION-------------------- MAIN.CPP #include #include "LinkedList.cpp" using namespace std; int main() { //fill your code here return 0; }   LinkedList.cpp #include using namespace std; class LinkedList { private: Node* head = NULL; public: void insertNode(int value) { //fill your code here } void deleteNode(int value) { //fill your code here } void display() { //fill your code here } };

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

STRICTLY USE TEMPLATE PROVIDE AT END OF QUESTION IN YOUR SOLUTION

----------------------------------------

Write a C++ program to implement insertion, deletion, and display operations in a Linked List


Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.

The class Node has the following member variable

Datatype Variable  Usage
int data to store data
Node* next to store the next node


Define the following public member functions in the class LinkedList.

Member function Function description
void insertNode(int value) This function inserts the data into the linked list at the end
void deleteNode(int value) This function deletes the node from the linked list
void display() This function is used to display the nodes in the linked list
 
In the main() function, read inputs and call the functions of the LinkedList class based on the inputs.


Note: 

  • If the Linked list is empty while displaying,  then print "List is empty" in the display() function.

 

Input and Output Format:

Refer to sample input and output for formatting specifications.

[All text in bold corresponds to input and the rest corresponds to output.]


Sample Input and Output 1:
1.Insertion
2.Deletion
3.Display
4.Exit
Enter your choice :
1
Enter the element to be inserted :
10
Element 10 is inserted into the Linked list

1.Insertion
2.Deletion
3.Display
4.Exit
Enter your choice :
1
Enter the element to be inserted :
3
Element 3 is inserted into the Linked list

1.Insertion
2.Deletion
3.Display
4.Exit
Enter your choice :
1
Enter the element to be inserted :
2
Element 2 is inserted into the Linked list

1.Insertion
2.Deletion
3.Display
4.Exit
Enter your choice :
3
10 3 2 

1.Insertion
2.Deletion
3.Display
4.Exit
Enter your choice :
2
Enter the element to be deleted :
3
Element 3 is deleted from Linked list

1.Insertion
2.Deletion
3.Display
4.Exit
Enter your choice :
3
10 2 
1.Insertion
2.Deletion
3.Display
4.Exit
Enter your choice :
4

Sample Input and Output 2:
1.Insertion
2.Deletion
3.Display
4.Exit
Enter your choice :
3
List is empty

1.Insertion
2.Deletion
3.Display
4.Exit
Enter your choice :
4
 

---------------------ONY USE BELOW TEMPLATE IN YOUR SOLUTION--------------------

MAIN.CPP

#include <iostream>
#include "LinkedList.cpp"
using namespace std;
int main() {

//fill your code here

return 0;
}

 

LinkedList.cpp

#include <iostream>
using namespace std;

class LinkedList {
private:
Node* head = NULL;
public:
void insertNode(int value) {
//fill your code here
}
void deleteNode(int value) {
//fill your code here
}

void display() {
//fill your code here
}

};

 

NODE.CPP

#include <iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
};
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education