Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

any help is greatly appreciated(c++) please ignore the first six images +x3 Ltsindteqp tseckepe alnclude -Listack, h* (f node constructer: faitialize new nodes wath an

any help is greatly appreciated(c++)
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
please ignore the first six images
image text in transcribed
image text in transcribed
+x3 Ltsindteqp tseckepe alnclude -Listack, h* (f node constructer: faitialize new nodes wath an input string 5 If s should be stered as the dats of the node If the nodes are not Initially linked to any other node If so be sure that the "next" Node is Hiked to n nollptr Micde:tande(sterting s) t. data =53 next = sul 11ptrt 3 f/constructor it inltimelize the head and kall field frea Listack clast If the stack should start with no itens If the heod and tadl should both be inltialited ad null polnters Lustackt tustack() I steck head = nidliptry tall = nullpter 1 I* define the top() nethod, which m11 retura the dati it the top of the rtack (renenber the "tap" of the stack if the newest element) If stack is enpty, feturn =w. sterins Histacktatep() 1 return "Hixthis"; If define the sitef) method, which wit1 return the nuber of notes in the rtack Int Listacktsine() 1 return 1 - Create the ney Mode and Indtialize the fields of class mode (data and next) - update the hesd, tail and count accordingly ietint: To update head and tall properly, vou have to consider taw seenarios! 1. If there is no element in the stack and this is the first one bolng to the stack 2. If there is another head in the stack vold uistackt tposh(staring s) f) 1 Finst, check if the stack is eapty er not. If not, updote the hesd, tail and count accordinghy. "Don"t forget to release menery uslag delete Mat: To updote head and tall preperly, You should constier tha dfferent scenartest 1. If Listeck hss nore than one eteeent 2. If Llstack has exactly one elenent vold ustacktspes(]) 1 3

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

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions