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
2 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]2 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 is the meaning of the word joystick
Roman55 [17]
<span>The meaning of Joystick is the control column of an aircraft</span>
4 0
3 years ago
Read 2 more answers
which of the following statements about the evolving relationship between traditional newspaper operations and blogging is true?
Alex_Xolod [135]

Newspapers will continue to collapse or have their newsroom staffs substantially reduced as a result of their excessive debt.

One of these was advocacy journalism, where the journalist actively advances a specific cause or point of view. Early American newspapers were partisan and sensational, but in the late nineteenth and early twentieth century, they started to become more objective and professional. Many journalists have been confused by the fall in recent years since readers don't seem to be all that interested in reading newspapers. The decline in newspaper production is caused by a number of factors, including social media, corporate ownership, internet access, and advertising. Three of the four primary purposes of mass communication—surveillance, correlation, and cultural transmission—involve journalism to a significant extent.

Learn more about professional here-

brainly.com/question/1938929

#SPJ4

3 0
1 year ago
Administrative activities, such as archiving project files, closing out contracts, documenting lessons learned, and receiving fo
asambeis [7]

Answer:

closing

Explanation:

6 0
3 years ago
If a program compiles fine, but it produces an incorrect result, then the program suffers from _______________.
tatiyna
In my answer I am making an assumption that there is no runtime error, if there is then the error is “a run-time error”.

The answer is the program suffers from a Logic Error
5 0
2 years ago
What procedures are involved in saving a file for the first time
ratelena [41]
You must name the file and you must also choose where the file will be saved.

3 0
3 years ago
Other questions:
  • I just started game development using unity, I’m trying to control my sphere moving on a flat surface using the W,A,S,D keys, if
    11·1 answer
  • Consider sorting n numbers stored in array A by first finding the smallest element of A and exchanging it with the element in A[
    13·1 answer
  • What languages do most of the students at Miami High School speak?
    6·2 answers
  • Can Someone give me a 5 paragraph essay about all of the uses in Microsoft Word.
    9·1 answer
  • It's better to create tables just by starting typing in the data that you want the table to store. There is no need to name fiel
    6·1 answer
  • The idea generating technique most often used in writing business letter is ?
    9·2 answers
  • Going to Grad School! In the College of Computing and Software Engineering, we have an option for students to "FastTrack" their
    11·1 answer
  • A user calls to report that she is experiencing intermittent problems while accessing the wireless network form her laptop compu
    9·1 answer
  • Betrand Meyer developed the ______ programming language which is not type-safe because it violates the law of contravariance.
    9·1 answer
  • Select the correct answer.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!