subject

Write a program which will rearrange and sort a stack of integer values, using two other stacks. The following algorithm describes how to do this: 1. Start with a stack of numbers named primary and two empty stacks named lower and higher. 2. Pop the first number from your primary stack and put it into the lower stack 3. Pop the next number from your primary stack, if it is smaller than the number you previously put into the lower stack, then add it to the lower stack, otherwise put it in the higher stack. 4. Repeat step 3 until the primary stack is empty. 5. Pop each of the elements from the lower stack and add them back into the primary stack. 6. Pop each element of the higher stack. If the value is greater than the value at the head of the primary stack, then add it onto the primary stack, otherwise add the number into the lower stack.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 11:00
This chapter lists many ways in which becoming computer literate is beneficial. think about what your life will be like once you’re started in your career. what areas of computing will be most important for you to understand? how would an understanding of computer hardware and software you in working from home, working with groups in other countries and contributing your talents.
Answers: 1
question
Computers and Technology, 23.06.2019 22:20
If i uninstall nba 2k 19 from my ps4 will my career be gone forever?
Answers: 2
question
Computers and Technology, 24.06.2019 09:30
Atype of researcher who uses computers to make sense of complex digital data
Answers: 1
question
Computers and Technology, 24.06.2019 16:30
Which program can damage your computer?
Answers: 1
You know the right answer?
Write a program which will rearrange and sort a stack of integer values, using two other stacks. The...
Questions
question
World Languages, 13.03.2021 04:30
question
Mathematics, 13.03.2021 04:30
question
Mathematics, 13.03.2021 04:30
question
Arts, 13.03.2021 04:30
Questions on the website: 13722363