0

I am trying to figure out how to sort an array with a stack class. The array (pointer) and its length should be passed to the function as parameters so that the original will be sorted. The array created in main() should contain a maximum of 20 integers which should be entered at runtime (input to be ended by the value 0 or automatically when the 20th value is entered). As it it is going through the array, it should place the largest number onto the stack (push). Each time it steps through the array it should find the next smallest number and push it onto the stack. I can assume no two numbers are duplicated in the array. When the stack is popped, all entries should appear in ascending order.

Thank you so much!

2
Contributors
5
Replies
6
Views
10 Years
Discussion Span
Last Post by iamthwee
0

Are you restricted to the number of stacks you can use?

No, but I would like to limit it to the minimum possible.

Thanks so much again!

0

Well then if you are not restricted by the number or the specific configuration ( serial or parallel ) of the stacks, a simple solution exists.

Am I going to show you? No that is your job.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.