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 is the on board storage C:
sasho [114]
On-board? im assuming so. an on-board storage is where people keep luggage/items on a ship.

hopefully i could help ;)
7 0
3 years ago
First, define an integer variable and assign it any value of your choice. Then you'll need to perform the following operations w
Tcecarenko [31]
Python code:

x=121
x += 9
x *= 2
x -= 4
x >>= 2
x -= 121
7 0
3 years ago
How do you optimize a website using JavaScript?
GenaCL600 [577]
You can edit the website (using Wordpress) -if it is your website of course-, and code JavaScript commands into the page that’s going to be uploaded.

Check out my website: www.birdbloggersblog.com

I coded that with HTML.
4 0
3 years ago
A system administrator at Universal Containers created a new account record type. However, sales users are unable to select the
Kobotan [32]

Answer:

The record type has not been added to the sales user profile.

The record type has not been activated.

Explanation:

They are two possible reasons in the available options for the sales user not being able to select the record type when creating new account records. they are :

  • The record type has not been added to the sales user profile.
  • The record type has not been activated.
4 0
3 years ago
Place the stages of teamwork in the correct order and describe what occurs in each.
Phantasy [73]
Pretty sure we need a picture
5 0
3 years ago
Other questions:
  • Which is a real-world example of a procedure?
    11·1 answer
  • When should students practice netiquette in an online course?
    9·1 answer
  • Choose a developing country and give 3 reasons why it is a developing country ​
    15·1 answer
  • Whats the best app for cheaters​
    9·1 answer
  • I need help!!!!
    13·2 answers
  • Which option is used to apply formatting to multiple objects on a single slide while still maintaining the ability to manage the
    14·2 answers
  • 5. RAM IS YOUR SYSTEM’S-
    14·2 answers
  • If you want to present slides to fellow students or coworkers which productivity software should you use to create them A. Word
    14·2 answers
  • Write a program to generate the 1,8,27,64,125,226,343,512,729,1000 series.​
    12·1 answer
  • Summary about Interface Design in system analysis
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!