1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lesya [120]
4 years ago
6

Descending selection sort with output during execution

Computers and Technology
1 answer:
FromTheMoon [43]4 years ago
3 0

Answer:

Check the explanation

Explanation:

Please find the code down

def selection_sort_descend_trace(numbers):

i=len(numbers)

print("Output: ")

for num in range(0,i-1):# traversing from 0 to N-2, total N-1 iterations

val=numbers[num]

start=num+1

end=i

t=0

for j in range(start,end):

if(val<numbers[j]):

remember=j

val=numbers[j]

t=1

if(t==1):# swaping onlf if greater number is available

temp=numbers[num]

numbers[num]=val

numbers[remember]=temp

for p in range(i):# printing

print(numbers[p],end=' ')

print("\n")

if __name__ == "__main__":

print("Enter the integers separated by space: ")

numbers=[int(x) for x in input().split(' ')]

selection_sort_descend_trace(numbers)

Taking input as string and splitting with space as delimiter , converting the split part to integer , finally append in the list.

You might be interested in
Which of the following might be appropriate to be created as a constant variable?
jasenka [17]

Answer:

Number of feet in a mile

Explanation:

In this problem, we need to find an option that to be created as a constant variable.

In option (a) "number of feet in a mile".

As 1 mile = 5280 foot

The number of feet in a mile is constant in every condition.

In option (b), (c) and (d)

number of people inside a store , current grade in a class , score in a football game are no fixed. It is not created as a constant variable.

Hence, the correct option is (a).

7 0
3 years ago
What is an Integrated Development Environment (IDE)?
kogti [31]

Answer: A diverse workplace for software developers

6 0
3 years ago
Can someone help me
Shtirlitz [24]
If u dont have anything important on there reboot it if you do choice 5
8 0
3 years ago
Match the correct features to virtualization and cloud computing.
ololo11 [35]

Answer:

i think i know

Explanation:

8 0
3 years ago
Why would a programmer use this code block?
olasank [31]
C. To select a parameter for a games’s appearance when it starts.
5 0
2 years ago
Other questions:
  • Write code to complete print_factorial()'s recursive case. sample output if user_val is 5: 5! = 5 * 4 * 3 * 2 * 1 = 120
    15·1 answer
  • What is Napoleon's friend's name? From the Napoleon Dynamite movie.
    14·1 answer
  • The _____________ loop allows the receiver to communicate with the sender in the imc process.
    11·1 answer
  • Which actions changed the look of the following word?
    8·2 answers
  • How do I do this? I know the shapes and everything but how do I do b, d, and e?
    7·1 answer
  • $100 to whoever finishes my assignment by june 1st
    11·1 answer
  • Correct or False, when formatting conditional data, I start by selecting the range of data that I want to format
    9·1 answer
  • . . ........Sad + sad= very sad
    7·2 answers
  • OSI layer for HDLC??​
    13·1 answer
  • What rpm command can be used to list the full paths for files within the bash package?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!