Will ratelifesaver!!!!! Create a linked list structure to implement a stack and
ID: 3614732 • Letter: W
Question
Will ratelifesaver!!!!!Create a linked list structure to implement a stack and alsocreate a linked list structure to implement a queue.
To demonstrate that the stack is working correctly, write a smallfunction using a stack that will determine if a given input stringis a valid tag.
A valid tag is defined as the character < followed by a group ofalphabetic characters followed by a >. Recall that casting acharacter to an int will give you the ASCII value of thatcharacter. The lowercase characters have ASCII values between 97and 122. The upperclase characters have ASCII values between 65 and90. You may assume that the input to the method is a C string, thatis an array of characters.
To test the queue, ask the user for input until they enter a -1.For each integer they give you, if it is odd, enqueue it in onequeue, if it is even, enqueue it in another queue. After a -1 hasbeen entered, display first the even numbers entered, and then theodd numbers.
Will ratelifesaver!!!!!
Create a linked list structure to implement a stack and alsocreate a linked list structure to implement a queue.
To demonstrate that the stack is working correctly, write a smallfunction using a stack that will determine if a given input stringis a valid tag.
A valid tag is defined as the character < followed by a group ofalphabetic characters followed by a >. Recall that casting acharacter to an int will give you the ASCII value of thatcharacter. The lowercase characters have ASCII values between 97and 122. The upperclase characters have ASCII values between 65 and90. You may assume that the input to the method is a C string, thatis an array of characters.
To test the queue, ask the user for input until they enter a -1.For each integer they give you, if it is odd, enqueue it in onequeue, if it is even, enqueue it in another queue. After a -1 hasbeen entered, display first the even numbers entered, and then theodd numbers.
Explanation / Answer
The basic idea is the following: A linked list is a link of nodes...assume we store pointers to thefirst and last node for efficiency. Stack push() - add a node to the front of the list pop() - remove the node at the front of the list and return thevalue of that node peek() - return the value of the node at the front of the list Queue enqueue() - add a node to the front of the list dequeue() - remove a node from the back of the list and return itsvalue
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.