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
kramer
3 years ago
13

Let us consider the easiest sorting algorithms – Maxsort. It works as follows: Find the largest key, say max, in the unsorted se

ction of array (initially the whole array) and then interchange max with the element in the last position in the unsorted section. Now max is considered part of the sorted section consisting of larger keys at the end of the array. It is no longer in the unsorted section. Repeat this until the whole array is sorted. a) Write an algorithm for Maxsort assuming an array E contains n elements to be sorted, with indexes 0, 1,…,n-1. b) How many comparisons of keys does Maxsort do in the worst case and on average? Submit source code, test cases, results, and the answers to part (b)
Computers and Technology
1 answer:
schepotkina [342]3 years ago
3 0

Answer:

count = 0

for x in range(len(array)):

if count == Len(array) -1:

break

max = max(array[:-1 - count])

count += 1

if array.index(max) == -1:

break

else:

hold = array[-1]

array[-1] = max

array[array.index(max)] = hold

Explanation:

The python program is an implementation of a maxsort. The for loop iterates over the array, getting the maximum number for each reduced array and swaps it with the corresponding last items.

You might be interested in
What are the primary functions of motor oil? a. Reduce friction and prevent wear b. Keep engine surfaces clean c. Remove heat to
ryzh [129]

The answer is E: all of the above.

7 0
3 years ago
Linda works from home occasionally and needs to set up her computer at work so she can remote in from her home office. Which too
qwelly [4]

Explanation:

Check the type of hard drive installed.

hope this helps you ❣️

4 0
2 years ago
Nathan would like to save his PowerPoint presentation as a video that can be replayed easily on any device at full quality. Whic
valentina_108 [34]

Answer:

Presentation Quality

Explanation:

It will be full quality as it is from when your presenting

6 0
4 years ago
Select all that apply.
True [87]

Answer:

                                          Option    A, B & C   are correct answers .

Explanation:

   

4 0
3 years ago
Read 2 more answers
Lots of data can be transferred in short time, when we have,
dusya [7]

Answer: B. Higher Bandwidth

8 0
2 years ago
Read 2 more answers
Other questions:
  • What should every Software Engineer know about Software Architecture?
    6·1 answer
  • I have a question about a hotel tv:
    10·1 answer
  • You are a disgruntled employee with a master’s degree in computer sciences who was recently laid off from a major technology com
    11·1 answer
  • ________ is a dedicated device designed to manage encrypted connections established over an untrusted network such as the Intern
    12·1 answer
  • The Telecommunications Act of 1996 was a mixed bag for cable customers. Although cable companies argued that it would bring more
    8·1 answer
  • In C++ write a program that prints out PI as a type double and a type float EXACTLY as shown below. Your program should have ONE
    13·1 answer
  • We define the following terms:
    11·1 answer
  • In the Microsoft Excel spreadsheet how many choices are possible when using a single IF statement​
    9·1 answer
  • What is media ethics. Explain two forms of maintaining media ethics with examples​
    13·1 answer
  • List six features of the Microsoft ​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!