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
A bluetooth device in ____ mode is part of the piconet but is in a low-power state.
adelina 88 [10]
A bluetooth device in park/hold mode is part of the piconet but is in a low-power state. These are power saving modes of operation for Bluetooth devices which are connected to a piconet and  are used when no data is to be transmitted.The hold mode is used when connecting several piconets or managing a low-power device such as temperature sensor. When the park mode is used t<span>he device is still synchronized to the piconet but does not participate in traffic.</span>
7 0
3 years ago
Source ________ contains instructions written by a programmer specifying the actions to be performed by computer software.
konstantin123 [22]

Source code contains instructions written by a programmer specifying the actions to be performed by computer softwa

7 0
2 years ago
NEED HELP ON TEST!!!
Phoenix [80]

Answer:

1.  \: speaker \:  notes \\ 2. \: accessible

5 0
3 years ago
What is the largest safety threat to the ISS?<br> Will give brainlest :)
bulgar [2K]

Answer:

The largest safety threat to the ISS are the micrometeorite and orbital debris (MMOD) fires, impacts and toxic spills. These pose the biggest threat to the ISS astronauts.

Explanation:

The debris is as a result of collisions. An observation revealed that once a certain mass is passed, collisions give rise to more debris.

Another report revealed that the station has about 55% chance of being hit by tiny space rocks over a 10-year period. They can protected by installing new impact-protecting panels to the exterior of the station.

ISS means International Satellite Station.

4 0
3 years ago
What are the 4 main types of parking
erik [133]
Parallel parking, emergency parking, parking on a hill, and prohibited parking. at least that's what the handbook in Arizona says, but check with your state handbook.)
6 0
3 years ago
Other questions:
  • Dan is a Civil Engineer for a company that builds nuclear power plants throughout the world. Which best describes the places he
    14·2 answers
  • The Internet has made it possible for most people to order all of their clothing online. While this may be a preference for some
    5·1 answer
  • Project using simple formulas
    15·1 answer
  • One blog may have a greater social influence than another when it has_______?
    12·2 answers
  • Dan works for an automobile company. He has designed a new model of a car based on an older version. Which technology can he use
    6·1 answer
  • Splunk knows where to break the event, where the time stamp is located and how to automatically create field value pairs using t
    7·1 answer
  • I need to know thr full number of pie
    8·1 answer
  • to see which employees received 3 or more bonuses. use the highlight cells rules conditional formatting to format cells in the r
    6·1 answer
  • Hi can someone please help me with this homework please?
    10·1 answer
  • Create a new data frame, first_south, by subsetting titanic to include instances where a passenger is in the first class cabin (
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!