Question: code in c++ Stack Sort Goal In this lab you will complete an application that uses the Abstract Data Type (ADT) stack. Resources Chapeer 4:



code in c++
Stack Sort Goal In this lab you will complete an application that uses the Abstract Data Type (ADT) stack. Resources Chapeer 4: Stacks Introduction In computer science, one of the important basic structures is the stack. It is of both theoretical and practical use. In its simplest form a stack has four operations Push o Places a value on the top of the stack. Pop o Removes the top value from the stack. . Empty o Determine if the stack has any values in it Top o Returns the top value on the stack but leaves the top value in the stack. Peek can be emulated by a pop followed by a push will mimic its operation Before continaing the lab you should review the material in Chapter 4 The application you will complete implements a sorting a stack using another helper stack. The stack should when sorted will have entries from the stack top to the stack bottom in ascending order (highest to lowest). The stack sort in this lab is of On2) Pre-Lab Visualization Stack Sort In order to soet values, use a source stack and a second helper stack that will have the sorted stack when the algorithm is done. See the end of this document for a recommended solution. Directed Lab Work Read the tutorial File IO Read Correctly that is posted on Canvas. The program should read in a file named stackLoader.xt that should have lines of space separated text integers, where each findegers is to be loaded into a source stack See the recommended solution at the end of this document to learn how to read in a line of integers The program must Be modular and well structured .Have a function that reads a line of integers to be put into a stack and indicates when there is not any more data Display the read in stack, using one function that displays the stack A function that sorts the stack using only another helper stack and stack operations .Display the sorted stack, using one function that displays the stack Loop around and repeat the processing o End the program when there is not any more data to be read in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
