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, 22.06.2019 22:20
Avariable of the data type arrays is storing 10 quantities. what is true about these quantities? a. the quantities all have different characteristics. b. the quantities all have the same characteristics. c. five quantities have the same and five have different characteristics. d. it is necessary for all quantities to be integers. e. it is necessary for all quantities to be characters.
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Best laptops for college [$100-$500 range]?
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Idon’t understand the double8 coding problem. it is java
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
The ieee 802.11: defines standards for wireless local area network (wlan) communication protocols. identifies various computers or devices connected to a network. verifies any resource attached to another computer on a network that is different from the computer to which the user is logged on. connects multiple local area networks (lans) and wide area networks (wans).
Answers: 2
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
English, 12.12.2020 16:20
question
Mathematics, 12.12.2020 16:20
question
Mathematics, 12.12.2020 16:20
question
Biology, 12.12.2020 16:20
question
Mathematics, 12.12.2020 16:20
question
Mathematics, 12.12.2020 16:20
Questions on the website: 13722363