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]
3 years ago
6

Descending selection sort with output during execution

Computers and Technology
1 answer:
FromTheMoon [43]3 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
Create a program in Matlab that prints the numbers from 1-100.
Burka [1]

Answer:

numbers = 1:1:100;

for num=numbers

remainder3 = rem(num,3);

remainder5 = rem(num,5);

 

if remainder3==0

disp("Yee")

else

if remainder3 == 0 && remainder5 == 0

disp ("Yee-Haw")

else

if remainder5==0

disp("Haw")

else

disp("Not a multiple of 5 or 4")

end

end

end  

end

Explanation:

  • Initialize the numbers variable from 1 to 100.
  • Loop through the all the numbers and find their remainders.
  • Check if a number is multiple of 5, 3 or both and display the message accordingly.
4 0
3 years ago
Select the correct answer.
Nady [450]

Answer:

B

Explanation:

In an ERD, the Crow Foot Notation Symbols are used with cardinality.

Hope it helps you

3 0
2 years ago
10 points if right...
aivan3 [116]

email because with chat it might wake up the kids and wbsite doesnt make sense. neither does blog so with email you can give personal messages and pictures.

7 0
3 years ago
Read 2 more answers
The proof that the Clique problem is NP-complete depends on a construction given in Theorem 34.11 (p. 1087), which reduces 3SAT
ki77a [65]

Answer:

Check the explanation

Explanation:

Kindly check the attached image below to see the step by step explanation to the question above.

5 0
3 years ago
Where is Peru located?
Illusion [34]
B. South America

[ignore:20 CHARACTERS]
4 0
3 years ago
Other questions:
  • Which of the following would an A/V technician NOT typically do? (Select all that apply).
    14·1 answer
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    5·1 answer
  • In Windows Vista, the Run command can be found in which application?
    6·1 answer
  • The function of the file server is to : 1. store data and software programs that can be used by client computers on the network.
    12·1 answer
  • . Write a short program that asks the user to input a string, and then outputs the
    15·1 answer
  • bro this scared me, i thought i just got hacked, could someone explain why when i went to ask a question, it kicked me out my ac
    9·2 answers
  • To add a new kind of information into the database you need to add a new table<br> true or false?
    7·2 answers
  • Recall that in C++ there is no check on an array index out of bounds. However, during program execution, an array index out of b
    9·1 answer
  • Overnight Delivery Service delivers a package to Pam. At the request of Overnight's delivery person, to acknowledge receipt Pam
    13·1 answer
  • How are water resources and air adversely affected by environmental degardation?​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!