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 02:30
Larry sent an email to andy. andy didn't open larry's email but still understood what the message was. how did andy determine the message without opening the email?
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. which step can possibly increase the severity of an incident? a. separating sensitive data from non-sensitive data b. immediately spreading the news about the incident response plan c. installing new hard disks d. increasing access controls
Answers: 2
question
Computers and Technology, 23.06.2019 18:50
Ais a picture icon that is a direct link to a file or folder
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
Computers and Technology, 17.05.2021 18:30
question
Mathematics, 17.05.2021 18:30