Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++, create a singly linked list having 5 nodes when instantiated. Create the following methods for your linked list: 1) InsertBeginning(): This function will

Using C++, create a singly linked list having 5 nodes when instantiated. Create the following methods for your linked list:

1) InsertBeginning(): This function will accept a value from the user, which will be used to create a new node at the beginning of the linked list.

2) InsertEnd(): This function will accept a value from the user, which will be used to create a new node at the end of the linked list.

3) Insert(): This function will accept a value and a location from the user, and will then add a node with the provided value in the location specified by the user.

4) DeleteBeginning(): This function will delete the first node of the linked list.

5) DeleteEnd(): This function will delete the last node of the linked list.

6) Delete(): This function will take a user input specifying which node to delete.

7) View(): This function will display the linked list.

This program should be menu driven, and once it is run, it will first display the initial linked list, and then ask the user for his/her option. Something like the following:

1.insert beginning node

2.insert last node

3.insert node at position

4.Delete first node

5.Delete last node

6.Delete node at specific location

7.Exit

The options will be the functions you are going to implement. The menu should be in a loop and will only end, if the user presses the option to terminate the program.

After each operation is performed, the resulting linked list will be displayed to the user, before asking for his/her option again.

Remember to consider every possible outcome of the program, and handle it accordingly.

Please include a SinglyLinkedList.hpp, SinglyLinkedList.cpp, and main.cpp.

I'm using Xcode for this. Please display code from the compiler and the output. Thank you!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

Students also viewed these Databases questions

Question

1. Identify the sources for this conflict.

Answered: 1 week ago

Question

3. The group answers the questions.

Answered: 1 week ago