Design a program takes as input, X, an unsorted list of numbers, and returns the sorted list of numbers in X. The program must be based on the following strategy: Handle the case when X is empty and has only 1 item. Split X into two lists, using the split function in the previous problem. Sort L and G. Put everything together into a sorted list. Test your program with 10 different unsorted lists.

Answers

Answer 1

Answer:

The program in python is as follows:

def split(X):

   L = []; G = []

   for i in range(len(X)):

       if X[i]>=X[0]:

           G.append(X[i])

       else:

           L.append(X[i])

   L.sort(); G.sort()

   return L,G

X = []

n = int(input("Length of X: "))

for i in range(n):

   inp = int(input(": "))

   X.append(inp)

   

if len(X) == 0 or len(X) == 1:

   print(X)

else:

   X1,X2=split(X)

   newList = sorted(X1 + X2)

   print(newList)

Explanation:

The following represents the split function in the previous problem

def split(X):

This initializes L and G to empty lists

   L = []; G = []

This iterates through X

   for i in range(len(X)):

All elements of X greater than 0 equal to the first element are appended to G

      if X[i]>=X[0]:

           G.append(X[i])

Others are appended to L

       else:

           L.append(X[i])

This sorts L and G

   L.sort(); G.sort()

This returns sorted lists L and G

   return L,G

The main function begins here

This initializes X

X = []

This gets the length of list X

n = int(input("Length of X: "))

This gets input for list X

for i in range(n):

   inp = int(input(": "))

   X.append(inp)

This prints X is X is empty of has 1 element

if len(X) == 0 or len(X) == 1:

   print(X)

If otherwise

else:

This calls the split function to split X into 2

   X1,X2=split(X)

This merges the two lists returned (sorted)

   newList = sorted(X1 + X2)

This prints the new list

   print(newList)


Related Questions

The ribbon in Excel is a
tab based user interface.
True
False

Answers

Answer:

Explanation:

This should help i think it is true just read this first "Like any other application, Excel has a basic workspace called the user interface. ... The Ribbon is the name given to the row of tabs and buttons you see at the top of Excel. The Ribbon's tabs and buttons bring your favorite commands into the open by showing multiple commands grouped in specific categories."

Answer:

True

Explanation:

. What is piracy? ???????????????????​

Answers

Answer: a practice similar to piracy but in other contexts, especially hijacking.

"air piracy"

the unauthorized use or reproduction of another's work.

Explanation:

Can somebody describe at least two cryptocurrencies with applicable/appropriate examples and discuss some of the similarities and differences?

Answers

So basically in order to describe you must first do whats know as the PEMDAS. After this you will reverse and clock in.

PLZZZZ HELP!!!
Select the correct answer.
What does the coding phase involve?
A.
testing and debugging code to remove all possible errors
B.
writing sequences of statements in a suitable programming language to produce the desired program
C.
designing a proper pseudocode using human-readable language
D.
compiling and interpreting programs into machine language
E.
breaking down the entire code into workable modules

Answers

I think the answer is b

Answer:

B.

writing sequences of statements in a suitable programming language to produce the desired program

Explanation:

During the coding phase, developers analyze the feasibility of each coding language and begin programming according to coding specifications. Without proper coding, the product won't function according to the customer's specifications, and new codes may need to be implemented

PLZ HELP

Select the correct answer.
Jack is part of the software quality assurance team in a company. Which activity should Jack perform as a part of software quality assurance?
A.
billing
B.
recruiting
C.
testing
D.
installing
E.
accounting

Answers

Answer:

E. accounting

Explanation:

just bare with me

Answer:D SORRY IF IM WRONG

Explanation:

PLS DONT HATE

Consider the following relation with functional dependencies as shown below.R{sno,sname,age,cno,cname,group}
R(A,B,C,D,E,F)
A-B,C
C-F
D-E
which normal form is the relation R is in?

Answers

Answer:

First Normal Form

Explanation:

The correct answer is - First Normal Form

Reason -

Given that,

A-B,C

C-F

D-E

Here the key is AD

The two partial Functional dependencies are -

A-B,C  

D-E

So,

They are not in Second Normal Form, but they are in First Normal Form.

As a student, how can you sustain focus and attention with technology distracting you from things that matter (academic, personal relationships, community involvement)?

Answers

To be able to sustain focus and attention with technology distracting you, one can make sure that they have no social media account, have an analogue cell phone and no use of the TV regularly.

How is technology a distraction to students?

The use of technology by college students have been found to have its usefulness as well as its effect on student.

The ways to stop Internet Distractions are:

Make up your mind on what Really Matters.Know that the use of Smartphone can support and be of issue  to  your Work.Turn Off Notifications. Deactivate your social media account.

Conclusively, by doing the above, on can be able to stop technology Distractions.

Learn more about technology from

https://brainly.com/question/25110079

Write a program that prompts the user to enter their name store this value in a variable called name Prompt the user for their current age store this value in a variable called Create a variable dogAge which takes the age entered and multiplies by 7 Print to the screen “Your name is" name "and in dog years you are" dogAge "years old" To join multiple parts together in a print statement use commas: print (“Your name is", name, "and in dog years you are", dogAge)​

Answers

Answer:

Explanation:

The following code is written in Python. It prompts the user for the name and age, saves them to their own variables. Then it creates and calculates the dogAge variable. Finally, it combines all of this information and prints out the statement.

name = input("Enter your name: ")

age = input("Enter your age: ")

dogAge = int(age) * 7

print("Your name is", name, "and in dog years you are", dogAge, "years old.")

In the file Calculator.java, write a class called Calculator that emulates basic functions of a calculator: add, subtract, multiply, divide, and clear. The class has one private member field called value for the calculator's current value. Implement the following Constructor and instance methods as listed below: public Calculator() - Constructor method to set the member field to 0.0 public void add(double val) - add the parameter to the member field public void subtract(double val) - subtract the parameter from the member field public void multiply(double val) - multiply the member field by the parameter public void divide(double val) - divide the member field by the parameter public void clear( ) - set the member field to 0.0 public double getValue( ) - return the member field

Answers

Answer:

Explanation:

The following calculator class written in Java has all the methods and variables requested in the question, each completing their own specific function to the member variable.

class Calculator {

   private double member;

   public Calculator() {

       this.member = 0.0;

   }

   public void add(double val) {

       this.member += val;

   }

   public void subtract(double val) {

       this.member -= val;

   }

   public void multiply(double val) {

       this.member *= val;

   }

   public void divide(double val) {

       this.member /= val;

   }

   public void clear() {

       this.member = 0.0;

   }

   public double getValue() {

       return this.member;

   }

}

A digital footprint is .

Answers

Your digital footprint is the trail of 'electronic breadcrumbs' you leave behind when you use the internet. It can include the websites you visit, the photos you upload and your interactions with other people on social networks.

Answer: is something you must manage

Consider four Internet hosts, each with a TCP session. These four TCP sessions share a common bottleneck link - all packet loss on the end-to-end paths for these four sessions occurs at just this one link. The bottleneck link has a transmission rate of R. The round trip time, RTT, for all fours hosts to their destinations are approximately the same. No other sessions are currently using this link. The four sessions have been running for a long time. What is the approximate throughput of each of these four TCP sessions

Answers

It is what it is and can’t be what

The correct response is - The TCP protocol creates a three-way connection between hosts on a network to send packets. It is a connection-oriented protocol. It is a protocol found in the OSI network model's transport layer. Given that all lost packets are sent again, it is trustworthy.

What is a TCP protocol?

One of the key protocols in the Internet protocol family is the Transmission Control Protocol. It was first used to supplement the Internet Protocol in the first network installation. TCP/IP is the name given to the full suite as a result.

The usage of TCP allows for the safe exchange of data between the server and the client. No matter how much data is transferred across the network, it ensures its integrity. It is therefore used to transfer data from higher-level protocols that demand the arrival of all sent data.

The usage of TCP allows for the safe exchange of data between the server and the client. No matter how much data is transferred across the network, it ensures its integrity.

To read more about TCP protocol, refer to - https://brainly.com/question/27975075

#SPJ6

WHAT DO YOU LEARN IN CODE.ORG​

Answers

Answer:

You learn how to animate and make websites

Explanation:

how to make websites and code/program games!!

Edna needs a safer car to drive. She likes to travel a lot, so she is looking for a small SUV. She is trying to decide between buying a new or used car. After doing some research, she finds out that most cars lose value each year by a process known as depreciation. You may have heard before that a new car loses a large part of its value in the first 2 or 3 years and continues to lose its value, but more gradually, over time. That is because the car does not lose the same amount of value each year, but it loses approximately the same percentage of its value each year. What kind of model would be most useful for calculating the value of a car over time?

Answers

Answer: Buy a new car

Explanation: If its a used car its breaks will be worn out and more likely the breaks will stop working in 6 months and you have to change them. May the forse be with you.

Why using a word processor than a typewriter?​

Answers

Answer:

Word processors allow users to save documents. This is not the case with a typewriter. Because text can be saved, editing does not have to occur immediately. The fourth characteristic of word processors is that they allow users to print their documents.

Answer:

There are many advantages to using a word processor instead of a typewriter. ... You have the ability to easily edit and change a word processing document. You can change a wide variety of formatting and colours. You can save files and re-use them.

Explanation:


Write
algorithm to read 100 numbers
then display the largest.

Answers

Answer:

see picture

Explanation:

There is no need to store all the values, you can just keep track of the highest. Up to you to create a numbers file with 100 values.

Write a program to display MPH (Miles per Hour). Create a function to calculate the MPH. Ask the user for the number of miles driven and the number of minute it took to drive that many miles. Validate that both the number of miles and the number of minutes is a positive, non-zero number. Pass both the number of miles and the number of minutes to the function, and have the function return the MPH.

Answers

Answer:

In Python:

def MPH(miles,minutes):

   mph = round(60 * miles/minutes,1)

   return mph

   

miles = float(input("Miles: "))

minutes = float(input("Minutes: "))

if miles>0 and minutes>0:

   print("MPH: ",MPH(miles,minutes))

else:

   print("Positive inputs only")

Explanation:

This defines the function

def MPH(miles,minutes):

This calculates mph rounded to 1 decimal place

   mph = round(60 * miles/minutes,1)

This returns the calculated mph

   return mph

The main begins here

This gets input for miles    

miles = float(input("Miles: "))

This gets input for minutes

minutes = float(input("Minutes: "))

If miles and minutes are positive

if miles>0 and minutes>0:

This calls the MPH function

   print("MPH: ",MPH(miles,minutes))

If otherwise, this prompts the user for positive inputs

else:

   print("Positive inputs only")

The number of P/E cycles that a solid-state drive can support may vary, within what range?
o
1 to 100
1,000 to 100,000
10,000 to 10 million
10 billion to 10 trillion

Answers

Answer:

C. 10,000 To 10 Million

Explanation:

Got It Right On Edge

Answer:

the answer is C. 10,000 to 10 million

Explanation:

i took the test on edge

The link between violence in the media and school shootings has been proven to be direct. True/false?​

Answers

Answer:

most of the time a school shooting will be done by a kis that has been bullied and picked on a lot (aka the quiet kid ) if we could stop bullying we could decreese the number of school shootins by a lot

Explanation:

Answer:

False

Explanation:

At least in my assignment the correct answer was false.

Click this link to view O*NET’s Work Contexts section for Librarians.

It describes the physical and social elements common to this work. Note that common contexts are listed toward the top, and less common contexts are listed toward the bottom. According to O*NET, what are common work contexts for Librarians? Check all that apply.

face-to-face discussions
pace determined by speed of equipment
cramped work space, awkward positions
indoors, environmentally controlled
telephone and electronic mail
freedom to make decisions

Answers

Answer:

1. b,d,f  2. a,b,c,f  3. b,c,e,f  4. a,c  5. a,b,c,e  6. a,b,c

7. d,e,f  8. a,b,e,f   9. a,c,d  10. b,d,f  11. c,e,f  12. a,c,e,f

Explanation:

all the answers to Finance Workplaces and Tasks Assignment 100%

Answer:

1, 4, 5, 6

Explanation:

the only options that are on the website

PLZZZ HELP
Select the correct answer.
Ed is the manager of a software design team. He needs to call a design review meeting. Who should he call for this meeting?
A.
only the stakeholders and external reviewer
B.
stakeholders and technical team
C.
the technical team and external reviewer
D.
only the technical team
E.
only the external reviewer and stakeholders

Answers

I think the answer is C

Answer:

C: the technical team and external reviewer

Explanation:

Plato/Edmentum

Franklin gave a presentation without any help from others. He didn't smile, and he looked at the floor during the presentation. What could Franklin have done to improve his presentation?
a Added more images to his slides to add engagement
b Asked for someone else to do the research for him
c Practiced in front of a trusted adult and asked for feedback
d Read the information right from the slides

Answers

Answer:

C. Practiced in front of a trusted adult..

Answer:

Practiced in front of a trusted adult and asked for feedback

Explanation:

PLZ HELP!!!

Select the correct answer.
Emma, the quality control manager in a software development company, asks the testing team to check whether the user interface is friendly. To which type of testing is Emma referring?
A.
usability testing
B.
data comparison
C.
validation testing
D.
stress testing
E.
destruction testing

Answers

Answer: A. Usability testing
Explanation:
Usability testing would be the correct answer because if the user interface isn't "frendly" then people won't be able to use it properly. Or if you are refering to the word friendly as looking safe, then even more so would be usability testing. Because if people don't like the fonts and styles of the user interface, they might not use it at all.

Who is the one you shouldnt have killed from fnaf?
(I already know but whoever answers first and right gets brainlest)

Answers

Answer: He was thought to be one of William Aftons victims who is also thought to be the child who possessing golden freddy

Explanation:

Answer:

Cassidy I guess

Debevec mentions using the technology he described to animate entire human bodies. Discuss why you think this is or is not a good idea? What are some of the challenges that you see with this idea? Explain your answers.

Answers

Answer:

Debevec is using the light of his team because this and that and because it’s manipulated

Explanation:

Write a program that creates a two-dimensional array initialized with test data. Use any data type you wish. Declare a two-dimensional array of data type char, int, double, or string. Assume the array is declared as follows: const int NUM_ROWS

Answers

Question:

Write a program that creates a two-dimensional array initialized with test data. Use any data type you wish. Declare a two-dimensional array of data type char, int, double, or string. Assume the array is declared as follows:  

const int NUM_ROWS = 3,  NUM_COLUMNS = 5;

test data: [10, 1, 1, 1, 1]  [7, 2, 20, 2, 9] [ 3, 3, 3, 3, 5]

Answer:

The program in C++ is as follows:

#include<iostream>

using namespace std;

int main(){

const int NUM_ROWS = 3, NUM_COLUMNS = 5;

int MyArray[NUM_ROWS][NUM_COLUMNS] = {{10, 1, 1, 1, 1},{7, 2, 20, 2, 9},{3, 3, 3, 3, 5}};

return 0;

}

Explanation:

To answer this question, we make use of the following parameters

Array name: MyArray

Array datatype: integer

The explanation is as follows:

This declares the array dimensions

const int NUM_ROWS = 3,  NUM_COLUMNS = 5;

This declares and initializes the array with the test data

int MyArray[NUM_ROWS][NUM_COLUMNS] = {{10, 1, 1, 1, 1}, {7, 2, 20, 2, 9}, {3, 3, 3, 3, 5}};

NEED HELP ASAP! Which field best organizes street addresses in a database?
A. Name
B. Address
C. Phone

Answers

The best one is name

HELPPPP In 5-6 sentences explain how technology has impacted engineers.

Answers

Answer:

Digitization is changing the playing field for engineers.

It alters the culture by providing more real-time data on the performance of equipment in the field today, allowing engineers to consider improvements that can be achieved in months through data algorithms rather than years or decades.

They can analyze and simulate almost everything that a product would go through, virtually.

Which of the following is NOT a common type of mic:
A. Lavalier
B. Shotgun
C. Stick
D. Parabolic
E. Handheld

Answers

Answer:

Uhh all of them are mics

Explanation:

I think it’s c I hope it’s right!

When using a small mic that attaches to your interview subject, where should you place that mic and why?

Answers

Directly at the subject's lips, position the microphone at a 45-degree angle. Shotgun microphones are highly directional supercardioid microphones that are designed to pick up sound in either direction. Place the microphone out of frame but as close to the subject as possible.

Multiple Choice: We have been assigned the task of developing a software testing tool (tester) that can assess reachability of statements in a program. Namely, given a program and a statement x in the program (line in the code), the tester should produce a sequence of inputs that demonstrates that the program can reach statement x, or declare that statement x is not reachable under any input sequence. What should we respond to the manager who assigned this task

Answers

Answer:

A. There is no algorithm to decide whether this can be done or not.

Explanation:

We should respond to the manager who assigned this task that there is no algorithm to decide whether this can be done or not. This is because there are many unknowns with the program that is provided. There are various programming languages and each one has its own structure and requirements in order to test them. Also, each function is created differently with different inputs that are necessary and different algorithms used. It is impossible to design a single algorithm that works to test every single provided program. That is why testers have to create custom test cases for each function.

Other Questions
There are 11 kites in the sky, and 6 of those kites are striped. What fraction ofthe kites are striped? Asian reactions to Western claims of racial and cultural superiority, such as the reaction by Shigenobu in the passage, were also instrumentalin the period 1918-1945 in theO growing popularity of laissez-faire economic policies in Asian statesO growing number of conversions to Christianity among Asian peoplesO intensification of anti-imperial resistance activities and independence movementsO establishment of European immigrant enclaves in many parts of South and East Asia Cual crees que sea la relacin que debe tener el ser humano con el ambiente? Jimmy Carter refused to play the ________ game as President of the United States Mount Ojos del salado is the highest mountain in Chile, with a peak at about 6900 meters above sea level. The Atacama Trench, just off the coast of Chile, is about 8100 meters below sea level (at its lowest point). what is the difference in elevations between mount ojos del salado and the atacama trench? Tennis balls are packaged in a silo-shaped container with a height of 23.5 cm and a radius of 2.9 cm. Find the surface area of the container. 1. In the diagram, the arrow #9 is pointing to an organelle calledmitochondrianucleussmooth endoplasmic recticulumendoplasmic recticulum I need help Im in math class! Help please Write the expression of the quotient of 44 and 11 please help me I want to get a good grade so my mom can appreciate me :D! Please Hurry! Which of the following would be most important in determining whether a woman is happy with her status as a single person?A) that shes single by choiceB) that she likes her jobC) that she has high-quality same-sex friendshipsD) that she has children The approximate circumference of a pizza is 107 inches. What is the radius of the pizza? Use 3.14 for . 1) The product of two numbers is 8. One of the numbers is x. Write an expression for the other number.2) Fiifi is 3 years older than JoJo. If JoJo is x years old, write an expression for the sum of their ages. Which of the following identifies three potential problems with solar energy?high start-up costs, greenhouse gas emissions, and disruption of the ecosystemdeforestation, greenhouse gas emissions, and disruption of the ecosystemhigh start-up costs, deforestation, and greenhouse gas emissionshigh start-up costs, deforestation, and disruption of the ecosystem I need some heeelp please what should be added to 3/4+-5/6+1/2 to get 0 Sal is experimenting with materials that dissolve in water. He finds a material that dissolves well in water. Which of these could itbe? Click to review the online content. Then answer the question(s) below, using complete sentences. Scroll down to view additional questions. Online Content: Site 1 What was considered Alexander the Greats greatest victory? Why was it considered so impressive? Which army did he defeat? (Site 1) How did they trade alliance with France help the United States win the war of independence against the britian What food stood for manliness, and was a sign of prosperity in Things Fall Apart?Your answer:It was potatoes.It was yams.It was coconuts.It was plantains.