Write a program that uses the while-loop that asks the user to enter integer numbers. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that uses the while-loop that asks the user to enter integer numbers. The user has to enter quit to quit the program. Put all the integers into a list and then use the Selection Sort Algorithm to sort the numbers from largest to smallest. The program must work exactly like the following examples. For example: Input Result 28 18 38 68 58 48 quit Enter an integer (or enter quit): 20 Enter an integer (or enter quit): 10 Enter an integer (or enter quit): 30 Enter an integer (or enter quit): 60 Enter an integer (or enter quit): 50 Enter an integer (or enter quit): 40 Enter an integer (or enter quit): quit Selection Sort Algorithm for [20, 10, 30, 60, 50, 40] After round e: [60, 10, 30, 20, 50, 40] After round 1: [60, 50, 30, 20, 10, 40] 50, 40, 20, 10, 30] After round 3: [60, 50, 40, 30, 10, 201 After round 2: [60, After round 4: [60, 50, 40, 30, 20, 10] Write a program that uses the while-loop that asks the user to enter integer numbers. The user has to enter quit to quit the program. Put all the integers into a list and then use the Selection Sort Algorithm to sort the numbers from largest to smallest. The program must work exactly like the following examples. For example: Input Result 28 18 38 68 58 48 quit Enter an integer (or enter quit): 20 Enter an integer (or enter quit): 10 Enter an integer (or enter quit): 30 Enter an integer (or enter quit): 60 Enter an integer (or enter quit): 50 Enter an integer (or enter quit): 40 Enter an integer (or enter quit): quit Selection Sort Algorithm for [20, 10, 30, 60, 50, 40] After round e: [60, 10, 30, 20, 50, 40] After round 1: [60, 50, 30, 20, 10, 40] 50, 40, 20, 10, 30] After round 3: [60, 50, 40, 30, 10, 201 After round 2: [60, After round 4: [60, 50, 40, 30, 20, 10]
Expert Answer:
Answer rating: 100% (QA)
The required python program def selectionsortarr n lenarr for i in range... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Repeat question 65 to determine the followin. Data in question 65. Complete the truth table for the following sequential circuit. a) The output string generated for the input: 00101101. b) In which...
-
Microkernel operating systems aim to address perceived modularity and reliability issues in traditional "monolithic" operating systems. (i) Describe the typical architecture of a microkernel...
-
Income statements for the current year and one year ago follow. Assume that all sales are on credit. For Year Ended December 31 Sales Cost of goods sold Other operating expenses Interest expense...
-
Imported beer is not the only product whose labeling may be misleading. For instance, although BMW is a German brand, most BMW X3s and X5s purchased in the United States are actually manufactured in...
-
In a distributed system, how does virtual memory play a role in resource sharing and isolation? What are the unique challenges associated with managing virtual memory in a distributed context ?
-
Find the indicated z-score(s) shown in the graph. Area = 0.475 Area = 0.475 z = ? 0 z = ? Z
-
Consider the following time series data: a. Construct a time series plot. What type of pattern exists in the data? b. Develop a three-week moving average for this time series. Compute MSE and a...
-
Beale Manufacturing Company has a beta of 1.5, and Foley Industries has a beta of 0.80. The required return on an index fund that holds the entire stock market is 14%. The risk-free rate of interest...
-
A steam power plant operating on a regenerative cycle, as illustrated in Fig. 8,5, includes just one feed water healer. Steam enters the turbine at 650(psia) and 900(oF) and exhausts at 1(psia)....
-
Describe a situation where research will help you as a manager to make a good decision?
-
Write a MatLaB program to compute the impulse responses of the systems described by following difference equations: (a) \(y(n)+y(n-1)+y(n-2)=x(n)\) (b) \(4 y(n)+y(n-1)+3 y(n-2)=x(n)+x(n-4)\).
-
Look at the following pseudocode: a. What value is stored in numbers[2]? b. What value is stored in numbers[0]? Constant Integer SIZE === 3 Declare Integer numbers [SIZE] = 1, 2, 3
-
Two projects, A and B, are analyzed using ranking present worth analysis with MARR at \(i \%\). It is found that \(\mathrm{PW}(\mathrm{A})>\mathrm{PW}(\mathrm{B})\). If \(M A R R\) is changed to...
-
Find P 80 , the 80th percentile for the red blood cell counts of women.
-
Compute the impulse responses of the systems below: (a) \(y(n)=5 x(n)+3 x(n-1)+8 x(n-2)+3 x(n-4)\) (b) \(y(n)+\frac{1}{3} y(n-1)=x(n)+\frac{1}{2} x(n-1)\) (c) \(y(n)-3 y(n-1)=x(n)\) (d) \(y(n)+2...
-
3) a) In your own words explain below what a point of diminishing returns for a revenue equation is and how this point (if it exists) affects investment decisions. Given that R(x) =100 +36x - x...
-
Consider the setup in Problem 16. Show that the relative speed of the ball and the point of contact on the stick is the same before and immediately after the collision. (This result is analogous to...
-
Modify the Student class in Listing 8.2 so that it implements the comparable interface. Define the compareTo method to order Student objects based on the value in studentNumber. In a main method...
-
What is the value of each of the following boolean expressions if x is 5,y is 10, and z is 15? a. (x < 5 && y > x) b. (x < 5 || y > x) c. (x > 3 || y < 10 && z == 15) d. (! (x > 3) && x!= z || x + y...
-
Suppose we want to compute the amount of money in a bank account with compound interest. If the amount of money in the account is m, the amount in the account at the end of the month will be 1.005m....
-
Is an oscillating object in translational equilibrium?
-
How far above Farth's surface must a \(10,000-\mathrm{kg}\) boulder be moved to increase the mass of the Earthboulder system by \(2.50 \mathrm{mg}\) ? Assume the same ratio of energy change to mass...
-
Show that for small displacements the restoring force exerted on part 2 of the displaced string in Figure 15.14 is linearly proportional to the displacement of that part from its equilibrium...
Study smarter with the SolutionInn App