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
Question #3
r-ruslan [8.4K]
A deque is a type of list
8 0
2 years ago
Read 2 more answers
What is episodic memory? knowledge about words, concepts, and language-based knowledge and facts information about events we hav
tankabanditka [31]

Answer:

<em>information about events we have personally experienced</em>

Explanation:

Episodic memory is <em>the actual memory of a particular event that a person has, so it will be different from the recall of the same encounter or experience by someone else.</em>

Often, episodic memory is mistaken with autobiographical memory, and while autobiographical memory includes episodic memory, it also depends on semantic memory.

<em>For instance, you might know the city you were born in and the date, though you have no particular birth memories.</em>

3 0
3 years ago
Which of the following changes the features (e.g., thickness of the line, shadow, 3-D effect, single or double, etc.) of the bor
lilavasa [31]
Border style
I hope it’s work
8 0
3 years ago
A network needs to be set up with 60 subnets. Given the IPv4 class C address 192.168.100.0, what subnet mask value should be use
d1i1m1o1n [39]
We are asked for the subnet mask and the total usable host. There are given values such as a network needs to be set up with 60 subnets given that the IPv4 class C address 192.168.100.0. The subnet mask is "255.255.255.0". The total host is "254".
6 0
3 years ago
How can solve a Boolean algebra problem?<br><br> Ex: JK+(~J+~K)L+JK
kicyunya [14]
I am not sure what you mean by that but a boolean is either true or false. So it is kind of like a true or false question. 4+4=7 is false. 2*4!=48 is true.
8 0
2 years ago
Other questions:
  • Investments in data networks, ip addresses, routers, and switches are ________ because of their impact on productivity, security
    14·1 answer
  • Kaitlin likes a particular design theme, but she is not sure about every single color for bullets, backgrounds, etc found in the
    5·2 answers
  • What does intergrated organization mean
    15·1 answer
  • How would you define a relational database ?
    12·1 answer
  • There is a renewed focus among today’s parents on providing food to their family.
    6·1 answer
  • The printer prints 16 pages every minute. How many pages are printed in 6 minutes?
    14·2 answers
  • PLS PAK I ANSWER NITO KAILANGAN LANGPO​
    6·1 answer
  • Project Description:
    8·1 answer
  • What is the Cycle of Dependency?
    14·1 answer
  • Which part of the computer is responsible for managing memory allocation for all applications
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!