Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create the new Node and initialize the flelds of class Node ( data and next ) update the head, tail and count accordingly Hint: To

Create the new Node and initialize the flelds of class Node (data and next)
update the head, tail and count accordingly
Hint: To update head and tail properly, You have to consider two scenarios:
If there is no element in the stack and this is the first one going to the stack
If there is another head in the stack
1
loid LLStack:apush(string s)
Node* nemilede = new Node(s):
if (count =0 f
head = nemilodes
tail = nemilodes
nemillode-snext = nullptrs
3
elsed
nemiode-snext = heads
head = nemilodes
3
countst+3
3
/*
First, Check if the stack is empty or not. If not, update the head, tail and count accordingly.
"Don't forget to release memory using delete
Hint: To update head and tail properly, You should consider two different scenarlos:
If LLStack has more than one element
If LLStack has exactly one element
%
void LLStacks:pop()
{
if count =0}
returns
3
if (head =-tan x
dellete heads
head = nullptrs
tall = nullptes
3
elsed
Node retip = head-snexts
delete heads
head = temps
3
count --8
}
OUTPUT
DEBUG CONSOLE
TERMINA
PORTS
COMMENTS
CPPP:25; FAILED:
knomin expression after the reported line}
a fatal error conditions
5EV - Seguentation violation signal
Rases: 2
1 failled
Clons: 2|1| passed I 1 fatled
image text in transcribed

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

Database And Expert Systems Applications 15th International Conference Dexa 2004 Zaragoza Spain August 30 September 3 2004 Proceedings Lncs 3180

Authors: Fernando Galindo ,Makoto Takizawa ,Roland Traunmuller

2004th Edition

3540229361, 978-3540229360

More Books

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago

Question

Carry out an interview and review its success.

Answered: 1 week ago