Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Statement: Based on the stackType class we develop in chapter 7, you are asked to add the following operations: 1. Modify the push operation

image text in transcribed

Problem Statement: Based on the stackType class we develop in chapter 7, you are asked to add the following operations: 1. Modify the push operation to be pushUnique, so that the duplication is not allowed in the stack. 2. Add reverseStack function as a none-member function to reverse the elements of the stack. 3. Add mirrorStack function as a none-member function to duplicate the items in the stack in reverse order. Programing Specifications: 1. Your are asked to develop a class named stackType with the following set of member functions: A class constructor to initialize the data members. The pop function to remove the item at stack top. The top function to return the value at the top of the stack. The pushUnique function to insert new value into the stack, such that a new item is pushed into the stack if and only if it is not in the stack, otherwise the push operation will fail. 1. Your are asked to develop the following none-member functions: The reverse Stack function to reverse the elements of a stack. The mirrorStack function that duplicate the content of the stack in reverse order. For example, suppose stack = {10, 20, 30, 40, 50), 10 is at stack bottom and 50 is at stack top. After a call to the function mirrorstack, stack = {10, 20, 30, 40, 50, 50, 40, 30, 20, 10). Important Notes: You are asked to implement the mirrorStack / reverseStack function using stack and queue objects only, any other structures are not allowed. (Hint : Declare stack and queue structures defined in CHSTL) Submission Notes: Late assignments will NOT be graded. > Once finished, compress your code and upload it into your elearning account. Your assignment must compile in order to be graded. The CPP file should have your name, ID, Section, and a short description about the project Comment should be written all over the program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions