Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello in next program SLListADT::~SLListADT() { for(node *p;!isEmpty();) { p = head->next; delete head; head = p; } } bool SLListADT::isEmpty() { return head ==

Hello

in next program

SLListADT::~SLListADT()

{

for(node *p;!isEmpty();)

{

p = head->next;

delete head;

head = p;

}

}

bool SLListADT::isEmpty()

{

return head == NULL;

}

int SLListADT::countNodes()

{

return count;

}

void SLListADT::printList()

{

if(count > 0)

{

for(node *tmp = head; tmp!= NULL; tmp = tmp->next)

{

cout << tmp->info << "\t";

}

cout << endl;

}

}

void SLListADT::initList()

{

for (node *p; !isEmpty(); )

{

p = head->next;

delete head;

head = p;

}

count = 0;

head = NULL;

tail = NULL;

}

void SLListADT::insertToHead(int a)

{

head = new node(a, head);

if (tail == NULL)

tail = head;

count++;

}

void SLListADT::insertToTail(int b)

{

if (tail != NULL)

{

tail->next = new node(b);

tail = tail->next;

}

else

head = tail = new node(b);

count++;

}

int SLListADT::removeFromHead()

{

if(!isEmpty())

{

int vla = head;

}

}

int SLListADT::removeFromTail()

{

}

bool SLListADT::find(int c) const

{

}

i want ask how to do the function for:

int removeFromHead(); // function to remove the head and return its info;

int removeFromTail(); // function to remove the tail and return its info;

bool find(int) const; // function to check if at-least one instance of given value exists in the list

void insertAt(int, int); // function to insert a value at the given position in the list

void removeAt(int); // function to remove a node from the list at given position

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

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

More Books

Students also viewed these Databases questions

Question

4. Identify cultural variations in communication style.

Answered: 1 week ago

Question

9. Understand the phenomenon of code switching and interlanguage.

Answered: 1 week ago

Question

8. Explain the difference between translation and interpretation.

Answered: 1 week ago