Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Linked List Program Help Rating all working solution thumbs up! My code is posted below. Assignment Details : My code: #include using namespace std;

C++ Linked List Program Help

Rating all working solution thumbs up! My code is posted below.

Assignment Details:

image text in transcribed

My code:

#include

using namespace std;

/*Linked List requirements

Finding a node, removing a node, displaying the entire list,

adding at the head.

*/

template

struct node

{

T data;

node *next;

};

template

class llist

{

public:

void search(T item);

private:

node *head;

node *tail;

};

/*

template

void llist::search(T item)

{

for (int i = 0; i

{

if(numNodes[i] == item)

return true;

}

return false;

}

*/

int main()

{

/*

llist ilist;

ilist.add(100);

ilist.add(200);

ilist.add(50);

ilist.display();

int location = ilist.find(200);

if (location >= 0)

cout

else

cout

location = ilist.find(1000);

if (location >= 0)

cout

else

count

ilist.remove(100);

ilist.remove(800);

ilist.remove(50);

ilist.display();

location = ilist.find(200);

if (location >= 0)

cout

else

cout

location = ilist.find(100);

if (location >= 0)

cout

else

cout

*/

return 0;

}

This assignment will involve creating a linked list class consisting of nodes that will, in addition to the requisite link, contain a piece of data determined by the use of a template. You must support finding a node, removing a node, displaying the entire list, and adding (at the head). You must also implement a destructor, but you do not need to rewrite the copy constructor or the You may assume that all data stored in the linked list will be unique (i.e. if you find a specific key then you will only find it once). Your main body should be as shown below int main () llist ilist; ilist.add (100); ilist.add (200) ilist.add (50) ilist.displayO int location ilist.find (200) if (location >= 0) cout 0) cout = 0) cout

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

Step: 3

blur-text-image

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

Know how to use reservations systems to inventory demand.

Answered: 1 week ago