Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CompE 260: Programming Assignment on Stague Create a data structure called Staque which can store only integers. The way Staque works is as follows: 1)
CompE 260: Programming Assignment on Stague Create a data structure called Staque" which can store only integers. The way Staque works is as follows: 1) If the number that you are trying to store in the Staque is even, it is pushed in front of the Staque 2) If the number that you are trying to store in the Staque is odd, it is pushed at the end of the Stague 3) When you try to remove a number from the Staque, you always do it from either the front or from the back of the Staque following the LIFO rule. Write a C++ code to implement a Staque. Since the data structure is all about inserting and deleting numbers, it would be a good option to use a linked list to implement Stague. Here's how your user interface should like: Insert the numbers 1, 3, 2, 4, 6, 89 in the Stague. Display the Staque: This is how the Staque will look like given that the above numbers were pushed in the Stague in the order given above: (front) 8 6 4 2 1 3 9 (back) Delete 2 even numbers and 1 odd number from the Staque and then display the Staque: Since deletion always follows the LIFO order, the numbers to be removed are 8 first and then 6(the 2 even numbers) and 9(odd) from the back of the Stague. The Stague shall then look like: (front) 4 2 1 3 (back). Run you program for at least 3 different input series & corresponding 3 different removal series
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started