Let us consider the easiest sorting algorithms – Maxsort. It works as follows: Find the largest key, say max, in the unsorted section 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)

Answers

Answer 1

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.


Related Questions

Search for articles describing front end and back end design of any application (example, a website). Summarize the concepts and elements for each one. Does the database that holds all the data exist at the front end or the back end

Answers

Answer:

No, the database is a back-end utility.

Explanation:

A webpage is a page of a website. The website is the collection of internet pages addressing particular information or service. There are two sides of web development, that is the front-end and back-end web development.

The front-end is the part of a website that interacts or is seen by the user of the website. The back-end developer scripts it to connect the server, route the webpages and communicate the data in the database.

In the program below, which variable has the same scope as strA?

def usernameMaker (strFirst, strLast):
return strFirst + strLast[0]

def passwordMaker (strA, numC):
if len(strA) > 4:
answer = dogName[0:3]
return answer + str(numC)
else:
return 'xk&' + str(numC)

Answers

Answer:

" numC " is the correct answer

Explanation:

The reason is that on line 3 of code it has "def passwordMaker (strA, numC):"

strA and numC are both in "( )" which is the scope and only things inside are varibles. Also its the only line that has  strA in it.

The scope of a variable is the extent at which the variable can be referenced.

The variable with the same scope as strA is variable numC

From the program, we have the following function definition

def passwordMaker (strA, numC):

Variables strA and numC are declared along with the function passwordMaker

This means that:

Variables strA and numC have the same scope

Hence, the variable with the same scope as strA is variable numC

Read more about scopes of variables at:

https://brainly.com/question/17102008

second question today 25 POINTS: What is the formula to balance a lever when both effort and resistance are present?

Answers

Answer:

To find the MA of a lever, divide the output force by the input force, or divide the length of the resistance arm by the length of the effort arm. In a first-class lever the fulcrum is located at some point between the effort and resistance forces.

Explanation:

What is the main advantage that a website builder offers for web development?

OA. It enables people with no coding skills to create websites.
OB. It allows developers to debug the code on your website.
OC. It allows developers to adjust the finer details more easily than an IDE does.
OD. It provides tools such as a resource manager and interpreter.

Answers

The correct answer is: OA. It enables people with no coding skills to create websites.

Answer: A

It enables people with no coding skills to create websites.

Explanation:

What is Code?
A) Rules of conduct
B) One or more commands designed to be carried out by a computer.
C) A pack between friends.
D) Edoc spelled backwords.

Answers

Answer:

In a class of statistics course, there are 50 students, of which 15 students  scored B, 25 students scored C and 10 students scored F. If a student is chosen at random from the class, what is the probability of scoring

not F?

Explanation:

Answer:

its b it's like opening multiple tabs

Put these events in the order in which they occurred,
starting with the earliest.

b
Germany prepares for an imminent attack on the island of
Sardinia.



Spanish officials pass off the information in the briefcase to
German agents.

Local fisherman recover the body of Major Martin off the coast
of Spain

Major Martin's name appears on a casualty list in a British
newspaper

Answers

Answer:

Local fisherman recover the body of Major Martin off the coast  of Spain .Spanish officials pass off the information in the briefcase to  German agents.Major Martin's name appears on a casualty list in a British  newspaper.Germany prepares for an imminent attack on the island of  Sardinia.

Explanation:

This above is the order in which Operation Mincemeat was executed in WW2 to deceive the Germans into believing that the Allies were going to invade the Balkans directly instead of Sicily which was their actual target.

The plan involved a fictitious Major Martin who had secret documents about the Allied invasion of the Balkans. After the body was released from a British submarine, it washed up in Spain where it was found by local fishermen.

Spanish officials then passed the information in the briefcase Major Martin had to German intelligence. To further reinforce the ruse, the British published Major Martin's name in a casualty list.

The Germans were thoroughly convinced and switched forces from Sicily for the defence of the Balkans and the island of Sicily.

i want to touch it but if i talked about the past , it would be i wanted to touch it or i wanted to touched it?​

Answers

Answer:

I wanted to touch it

Explanation:

since you put the setting in the past you can use present verbs because we already know it's something that already happened

what is the full form of ARPANet, WAN,FTP,DCP,HTML,ISP and last WWW​

Answers

Advanced Research Projects Agency Network,

wide area network

File Transfer Protocol

?

Hypertext Markup Language

Internet service provider

world wide web

ARPANET — Advanced Research Projects Agency Network

WAN — Wide Area Network

FTP — File Transfer Protocol

DCP — Diploma Computer Programming

HTML — Hyper Text Markup Language

ISP — Internet Service Provider

www — World Wide Web

HOPE IT HELPS

PLEASE MARK ME BRAINLIEST ☺️

Write a Java statement that declares and creates an array of Strings named Breeds. Your array should be large enough to hold the names of 100 dog breeds.

Answers

Answer: String[]Breeds = new String[100]

How can you reboot a laptop?
How do you get an upgrade for a tower?
Lastly, How do u get a Virus Protection.

Answers

Question: How can you reboot a laptop?

Answer: Rebooting a computer simply means to restart it. If you're using Microsoft Windows, you can click the "Start Menu," click the "Power" button and click "Restart" in the submenu to restart your computer. If you still have problems with the computer, you can also choose the "Shut Down" option in the "Power" submenu to turn the computer off altogether, let it sit for a bit and then turn it back on.

Question: How do you get an upgrade for a tower?

Answer: You can upgrade your existing Tower installation to the latest version easily. Tower looks for existing configuration files and recognizes when an upgrade should be performed instead of an installation. As with installation, the upgrade process requires that the Tower server be able to access the Internet. The upgrade process takes roughly the same amount of time as a Tower installation, plus any time needed for data migration. This upgrade procedure assumes that you have a working installation of Ansible and Tower.

Question: How do you get a Virus Protection?

Answer: Use an antimalware app - Installing an antimalware app and keeping it up to date can help defend your PC against viruses and other malware (malicious software). Antimalware apps scan for viruses, spyware, and other malware trying to get into your email, operating system, or files.

Hope this helps! :)

Your manager has asked you to write a program that displays the percentage of males and female in your class. The program should prompt the user to enter the number of males and females and display the results.

Answers

Explanation:

The program using python programming language would be:

First, we write the Input prompt.

Input  prompt for the user

number_of_males_in_class = int (input ('Enter the number of males: '))

number_of_females_in_class = int(input('Enter the number of females: '))

Next, we write the Process algorithm.

Process  algorithm

total_number_of_students_in_class = number_of_females_in_class + number_of_males

_in_class

percentage_of_males_in_class = number_of_males_in_class / total_number_of_students

_in_class

percentage_of_females_in_class = number_of_females / total_number_of_students

Finally, the Output process

Output process

print('Total number of males in class =', format(percentage_of_males_in_class, '.0%'))

print('Total number of females =', format(percentage_of_females_in_class, '.0%'))

Plz help me

What is a challenge in wild animal photography?


A. They are easy to close to


B. They don’t move much


C. You can’t position them


D. All of the above

Answers

Answer: C
Explanation: You cannot just go up to a wild animal and make it move to wherever you want it to be. In other words, you cannot manipulate nature.

Answer:

C. You can’t position them for K12

Variable X is a *
Public Class Form)
Sub Example 10 Handles MyBase.load
Dim X As Integer
X = 10
MsgBox("The value of X is "& X)
End Sub

Answers

Answer:

Variable X is a local variable.

Explanation:

X exists only inside the sub.

Which protocol is well known for its use in the the home security and home automation industry, uses a mesh topology, makes devices act as repeaters, and has a low data transfer rate

Answers

Answer:

Z-Wave

Explanation:

Z-WAVE can be seen as a protocol which enables home automation and home security to take place because with home automation home appliances as well as lighting , sound systems among others can be smoothly control and monitor.

Secondly Z-WAVE make uses of mesh network, allow appliances to smoothly and successful communicate with each other.

Lastly Z-WAVE which is a wireless protocols make use of data transfer rate that is low.

Therefore Z-WAVE is important because it enables wireless monitoring of home appliances to take place in a smart home.

Sarah used a grid to create this layout for a website. Which rule of composition did Sarah use for the grid?



A.
unity
B.
rule of thirds
C.
contrast
D.
rhythm

Answers

Answer:

B rule of thirds

Explanation:

Answer:

a

Explanation:

Which ad extensions can serve automatically?

Answers

Answer:

Sitelink, structured snippets, and callout.

Explanation:

Those 3 are the 3 main ad extensions that can serve automatically. I learned this on Monday.  

Write a class called Date that represents a date consisting of a day, month, and year. A date object should have the following methods: public Date(int day, int month, int year) -- Constructs a new Date object to represent the given date public int getDay() -- returns the day value of this date public int getMonth() -- returns the month value of this date public int getYear() -- returns the year value of this date public void addDays(int days) -- Moves the Date object forward in time by the given number of days public int daysTo(Date other) -- Returns the number of days between this Date and the other Date public boolean isLeapYear() -- Returns true if the year of this Date is a leap year. A leap year occurs when the value of the year is divisible by 4, except when it is divisible by 100 and not 400 (so 1700, 1800, and 1900 are not leap years) public String toString() -- returns a String representation of this date in the form day/month/year Write a program in which to test your class. This program should prompt the user to enter the days, months, and years of two separate dates, and then print out the number of days between these two dates.

Answers

Answer:

No

Explanation:

Because it's years and its also very public

why ROM is called non volatila Memory?​

Answers

Answer:

Explanation:

ROMs that are read only memory are called non volatile because all of the data that are inside it happens to not get erased after shutting down the system or computer and starting it all over again. The opposite is this phenomenon is RAM. In RAM, they are being called volatile because all of the data that are inside it happens to get erased once shutting down of the system or computer occurs and it is being restarted.

This is telling us that ROM irrespective, stores data while it is on and also while it is off, it doesn't matter. It never forgets data, unless of course, in a situation whereby it is erased.

Volatile memory stores data as long as it is powered. ROM, which stands for read-only memory, is called non-volatile memory because of they do not lose memory when power is removed. Data stored in ROM cannot be electronically modified after the manufacture of the memory device.

HOPE IT HELPS

PLEASE MARK ME BRAINLIEST ☺️

A(n) ___________________ is a set of characters that the originator of the data uses to encrypt the text and the recipient of the data uses to decrypt the text. (230)Group of answer choices

Answers

Answer:

The appropriate response will be "Public key".

Explanation:

A public key would be created in something like such key encryption cryptography consisting incorporates asymmetric encryption of the keys algorithms. Those same keys have been utilized to transform a document to even such an unintelligible form. Decryption consists done using only a separate, however corresponding, secret address or private key.

As per the scenario, a Public key would be the set of such characters.

A public key would have been generated using cryptographic protocols or the techniques, which contains asymmetric keyword encrypted methods.These very same keys were being used to convert a memorandum or manuscript to such an unintelligible state. Decryption has always been accomplished solely through the use of a completely separate, but associated, highly classified address and otherwise key.

Thus the above response is correct.

Learn more:

https://brainly.com/question/20709892

What is a feature of Print Preview?

Fit to Document
Fit to Margin
Fit to Page
Fit to Size

Answers

fit to page i believe

Answer:c

Explanation:

Leo needs to consolidate data in multiple worksheets by performing a calculation across all worksheets on the same cells.
Which feature should he use to perform this task?
A) data consolidation
B) 3-D reference
C) grouped cells
D) linked cells

Answers

A do you think is the answer

Answer:

3-D reference

Explanation:

Edge 2022

Sam is conducting research for a school project on the American Revolution. Which of the following kinds of software will help with research notes? music editing software word processing software presentation software spreadsheets

Answers

Answer:

Students analyze the techniques that make for good storytelling I think. :}

Explanation:

[] Hello ! []

Answer:

B. Word Processing Software

Explanation:

I hope it helped! :]

Write a program that assigns a value the value of 50000 to an integer variable x, assigns the value of x*x to an integer variable y, and then prints out the value of y.

Answers

Answer:

Explanation:

The following code is written in Java and does exactly what the question asks. The variables are long variables instead of integers because integer variables can only be a maximum of 2147483647 and the product of these two variables is much higher than that.

public static void main(String args[]) {

               long x = 50000;

               long y = x * x;

               System.out.println(y);

       }

. A Worker in Microworkers can also be an Employe

Answers

Answer:

A Worker in Microworkers can also be an Employer: After reaching $25 in earnings. After placing an initial deposit of $10, and launching a valid campaign. If success rate is maintained at 75% before launching a campaign. After creating a separate Employer account.

Explanation:

1.4 Assume the source port number used by the above browser is 5100. Now a second browser is opened on the client also wants to request the same webpage. Does the second browser use the same source port number of 5100? Why? What is the destination port number?

Answers

Answer:

100000001

Explanation:

A website that sells computer hardware to large organizations --> .com. A website operated by the state of California --> .gov. The website of the US Coast Guard --> .mil. The website of a group of individuals who work toward protecting gray wolves --> .org

What is the government website?

The government website is the official US government website and is used for a domain name that is based on the word government. It is administrated by the cyber security and infrastructure security agency.

It is sponsored top level domain and only the US government is federal govt uses such websites.a website that sells computer hardware to large organizations a website operated by the state of California.

The website of the US Coast Guard the website of a group of individuals who work toward protecting gray wolves. a website that sells computer hardware to large organizations a website operated by the state of California.

Therefore, A website that sells computer hardware to large organizations --> .com. A website operated by the state of California --> .gov. The website of the US Coast Guard --> .mil. The website of a group of individuals who work toward protecting gray wolves --> .org

Find out more information about the driver's license on:

brainly.com/question/13112961

#SPJ2

A customer connects to your business network. The customer uses a packet sniffer to intercept network traffic in an attempt to find confidential information. This is an example of which type of attack

Answers

Answer:

Self Attack

Explanation:

I pick self attack because the person is trying to harm you.

What two solutions address lack of human access to clean water

Answers

Answer:

THREE strategies which local municipality is implementing in addressing the issue of lack of clean water caused by human factors include:

1) Increasing the amount of tax for those companies which are opening their wastes into water sources which can help built better water cleaning and recycle system.

2) Tree plantation is another strategy to help secure the water sources and naturally keep cleaning it.

3) Running awareness campaigns for general people to keep the water sources clean as well as use the only amount of water which they need and not waste it.

Explanation:

i hope this helps you

A coworker just sent you a presentation to review. You noticed that she used different types of transitions on the same slide, and the animations and videos were distracting from the topic. Give your coworker advice about guidelines she can follow when using animation, transitions, and multimedia. Be sure to include at least four guidelines

Answers

Answer:

The transitions presented should either be different on each slide or the same type but only one on each slide shown. Pictures and videos shouldnt be included a lot. At least two photos or one on each slide, while videos should only be one on the very last slide.

Explanation:

running away from home

Answers

Answer:

wait what?

Explanation:

Well heads up

Be careful theres guys and woman to take advange of you so stay careful

Human trafficking is such a horrible thing :C

Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in a program that takes two integer inputs, and outputs the largest magnitude value. Ex: If the inputs are: 5 7 the function returns: 7 Ex: If the inputs are: -8 -2 the function returns: -8 Note: The function does not just return the largest value, which for -8 -2 would be -2. Though not necessary, you may use the built-in absolute value function to determine the max magnitude, but you must still output the input number (Ex: Output -8, not 8). Your program must define and call the following function:

Answers

Answer:

The question is answered in python

def max_magnitude(a,b):

   if abs(a) > abs(b):

       return a

   else:

       return b

       

num1 = int(input("Num 1: "))

num2 = int(input("Num 2: "))

print(max_magnitude(num1,num2))

Explanation:

This question is answered using the concept of absolute value to get the integer with the highest magnitude

First, the function is defined with integer parameters a and b

def max_magnitude(a,b):

This checks if a has the highest magnitude

   if abs(a) > abs(b):

If true, it returns a

       return a

If otherwise, it returns b

   else:

       return b

       

The main starts here

The next two lines prompt the user for inputs

num1 = int(input("Num 1: "))

num2 = int(input("Num 2: "))

This calls the function

print(max_magnitude(num1,num2))

Other Questions
European traveler who visited China during Mongol ule in the 1300's.A. MongolsB. Genghis KhanC. Kublai KhanD. Marco PoloE. steppes Why did protesters throw tea in Boston Harbor?The protestors were expressing their opposition to a tax on tea.The protestors were expressing opposition to Native Americans.The protestors were expressing opposition to slavery.The protestors were expressing opposition to the tour of Boston. 1100 now yay!!!!!!!!!!!!!!! (02.01 MC) Which of the following did the idea of the social contract lead the Founding Fathers to believe? that they were justified in seeking independence from England that the government they created should have three branches with equal power that they should write laws to expand their relationship to the king that they should push for a written constitution to limit the power of the king 4 Imagine that someone has called you "a nerd." You ask the person to stop and explain your feelings have been hurt. He or she apologizes and never calls you a nerd again. Based on the evidence in the text, what can you conclude about that person? A That person is a bully. B That person is not a bully. C That person knows how to defend himself or herself. D That person does not know how to defend himself or herself. Sign out O How do plants use carotenoids? Please help me I mark u brainiest like it and rate it five stars please help Which of these is not a study of scienceGeographyZoologyBotanyBiology Please help !!! I neeed this ASAP please Because any natural element used in the cathode produced negative particles that bent to a positive charge, scientists concluded that: A) all atoms contained negative electronsB) all atoms are actually negativeC) atoms were indivisible and had no sub-particlesD) metals contained positrons (1 point) A recent report for a regional airline reported that the mean number of hours of flying time for its pilots is 56 hours per month. This mean was based on actual flying times for a sample of 51 pilots and the sample standard deviation was 9.5 hours.2. Calculate a 90% confidence interval estimate of the population mean flying time for the pilots. Round your result to 4 decimal places.( , )3.Using the information given, what is the smallest sample size necessary to estimate the mean flying time with a margin of error of 1.25 hour and 90% confidence helpppp!!!!!!!!!!!!!!! Do acids lose or gain hydrogen ions? Helpplease When a mixture of oxygen and hydrogen is ignited in a test tube, the reaction shown occurs. Hydrogen + Oxygen Water + Energy Substances that form as a result of a chemical reaction are called catalysts catalysts products products precipitates precipitates reactants If Odysseus wasnt a good hero what couldve happened to him, his wife, his son and his kingdom? What was Odysseus able to do. Because he was a good hero? What is a 'choral octavo ? O A. a music book OB. a Catholic song book Oc. a musical score for many people D. a large roll of sheet music What is the process of focussing your full attention on what another person is saying? Reading at a slower rate or reading parts of text are both helpful strategies when youre trying to i did my work. this sentence is _________a) past progressiveb) futurec) past simple d) none complete the patterns0, 1, 3, 7, 15, 31, _0, 1, 1, 2, 3, 5, 8, 13, _