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
Identical objects are placed in Beaker A and in Beaker B. The objects float as shown in the diagrams below. What can you conclud
yaroslaw [1]
Which beaker has the object floating?
6 0
3 years ago
Why are you unable to modify the budget file, when you have the allow full control ntfs permission?
Alinara [238K]

I don't really know the perfect answer to this but I would say because of todays technonlogy


3 0
3 years ago
When authenticating a user's password, the password supplied by the user is authenticated by comparing the ____ of the password
Bas_tet [7]

Answer:

Hash.

Explanation:

An authentication can be defined as the process of verifying the identity of an individual or electronic device. Authentication work based on the principle (framework) of matching an incoming request from a user or electronic device to a set of uniquely defined credentials.

Basically, authentication ensures a user is truly who he or she claims to be, as well as confirm that an electronic device is valid through the process of verification. Smart cards, digital certificates, picture passwords, and biometrics are generally used to perform an authentication in the field of computer.

Hence, when authenticating a user's password, the password supplied by the user is authenticated by comparing the hash of the password with the one stored on the system.

In Computer science, a hash function can be defined as any function which is used to map data by accepting a block of data with variable length size or arbitrary size as input to produce a fixed size hash values or codes.

Generally, when a block of data (input) of arbitrary size is hashed, the resulting hash values or codes is usually smaller than the input data. Thus, hash functions are considered to be a compression of data and as a result, sometimes called compression functions. Basically, the block size of a hash function typically ranges from 128 bits to 512 bits.

5 0
2 years ago
What is the name for the base-2 system used by computers to represent
NemiM [27]

Answer:

B. Binary Code

Explanation:

Binary code is the base-2 system used by computers to represent data. Binary code consists of 0's and 1's which can be used to represent states such as on or off; go or no-go and more.

7 0
2 years ago
How many instructions can the microprocessor execute each second if the assembly line is present?
SpyIntel [72]

The instructions that he microprocessor can execute each second if the assembly line is present will be depending on the workload and the architecture’s core because it is all depending on the speed of the CPU and the multiplier that it acquires.

3 0
3 years ago
Other questions:
  • What is the opportunity cost of computers when moving from point A to point B? -15 DVDs b. What is the opportunity cost of compu
    13·1 answer
  • Write an SQL statement to list the Name of employees who have worked on a property in New York .
    7·1 answer
  • A large IPv4 datagram is fragmented into 4 fragments at router 1 to pass over a network with an MTU of 1500 bytes. Assume each f
    15·1 answer
  • John is runnig his Database application on a single server with 24 Gigabytes of memory and 4 processors. The system is running s
    6·1 answer
  • What is the maximum current that should be allowed in a 5.0w 220 resistor?
    12·1 answer
  • What are the defenses to protect against these attacks?
    13·1 answer
  • What is the name of the process of checking the client's production environment to ensure software and hardware compatibility wi
    5·2 answers
  • Complete main() to read dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not
    10·1 answer
  • Here is something cool
    5·2 answers
  • Anne wants to hide her age by converting it from 13 to 1101. Which number system is Anne converting to?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!