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
The general case in a recursive function is the case for which the solution is obtained directly.
Reika [66]

Answer: False.

Explanation:

The general case of recursive function is when the solution is obtained recursively by simplification at each step.

However, it is the base case in a recursive function when the solution is obtained directly.

The general case must be reducible to base to arrive at a solution else the recursion would be a infinite recursion.

4 0
3 years ago
What are the two basic literary forms?
Korolek [52]
Fiction and nonfiction
6 0
3 years ago
True or false This html element puts the text in the centre of the webpage. "Something really cool "
Romashka [77]

Answer:

true.

Explanation:

i hope it help u

mark me as brainliest

6 0
3 years ago
Communication between a computer and a keyboard involves ______________ transmission.
4vir4ik [10]

Answer:

Simplex transmission

Explanation:

Communication between computer and keyboard involves which transmission? Answer: Simplex transmission requires communicating between a computer and a keyboard. The simple transmission & communication channel allows data from only one direction.

8 0
2 years ago
Victor has been murdered, and Art, Bob, and Carl are suspects. Art says he did not do it. He says that Bob was the victim's frie
-BARSIC- [3]

Answer:

Bob

Explanation:

we can use symbolic reasoning to prove that Bob is not innocent without enumerating all of the cases.

6 0
3 years ago
Other questions:
  • URGENT!! You decide not to use any recipes or information from the "Don't Be an Animal Murderer" Web site. What characteristic o
    7·2 answers
  • Which of the follow represents a form of disruptive technology? Tend to open new markets and destroy old ones A new way of doing
    11·1 answer
  • Ben sends a few emails over the weekend to his relatives. Where should Ben place his laptop so that he can avoid slouching while
    11·1 answer
  • A weighted GPA counts__more highly.
    12·1 answer
  • Guys for those who are familiar to bubble gum sim...THERE IS A HUGE EVENT AND I DONT WANT TO FAIL AN EVENT...(again) is anyone w
    9·1 answer
  • Which statement is true for rapid prototyping? (A. It creates a two-dimensional model of a part or a product, from the original
    8·2 answers
  • What are the five Ws?<br> (I don’t even know what this means)
    5·2 answers
  • What defines the scope of a project?
    5·1 answer
  • I don't have a split screen in my Samsung Galaxy A02 why???​
    13·1 answer
  • What is the maximum number of guesses it will take to find a number <br> between 1 and 64?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!