Homework: Insertion Sort
Create a public class named InsertionSorter. It should provide one class method sort. sort accepts an array of Comparables and sorts them in ascending order. You should sort the array in place, meaning that you modify the original array, and return the number of swaps required to sort the array as an int. That's how we'll know that you've correctly implemented insertion sort. If the array is null you should throw an IllegalArgumentException. You can assume that the array does not contain any null values.
To receive credit implement insertion sort as follows. Have the sorted part start at the left and grow to the right. Each step takes the left-most value from the unsorted part of the array and move it leftward, swapping elements until it is in the correct place. Do not swap equal values. This will make your sort unstable and cause you to fail the test suites.

Answers

Answer 1

Answer:

Explanation:

I have written the code in Java. It contains the class Insertion Sorter which has the InsertionSort function. This function uses the insertion sort algorithm to sort a comparable array and if it fails to do so for whatever reason it throws an Illegal ArgumentException. If it sorts the array correctly it returns the number of changes that needed to be made in order to correctly sort the array. Due to technical difficulties I have attached the code as a text document below and proof of output in the picture below as well.

Homework: Insertion Sort Create A Public Class Named InsertionSorter. It Should Provide One Class Method

Related Questions

You have an audio that contains one pause for 0.2 seconds and another one for 0.6 seconds. When do you need to create a new segment?

Answers

A new segment should be created when there is a pause for more than 0.5 seconds

Writing a function that implements a loop to collect a set amount of data. The function should use the serial object, the recording time, and the iteration (city number) as input arguments and return an N x 2 array with the time in the first column and the recorded light level in the second. (4 pts). Include in this function outputs to the Command Window noting the starting and stopping of the recording.

Answers

You can still go on a date with you if I get a text from my friend that is in a relationship and you don’t know why

Is this correct? I say its B, but my friend says its D.

Answers

The answer is B, best of luck!

Characteristics of RAM​

Answers

Answer:

Short Data lifetime, Less Expensive, Needs to be refreshed often, Smaller in size, etc. tell me if you need more.

The following table represents the addresses and contents (using hexadecimal notation) of some cells in a machine's main memory.Starting with this memory arrangement , follow the sequence of instructions and record the final contents of each of these memory cells: Address Contents 00 AB 01 53 02 D6 03 02 Step 1. Move the contents of the cell whose address is 03 to the cell at address 00. Step 2. Move the value 01 into the cell at address 02. Step 3. Move the value stored at address 01 into the cell at address 03.

Answers

Answer:

I DON'T KNOW THE ANSWER SO SORRY

Explanation:

BUT THANKS FOR THE POINTS

In python please!!! Write the definition of a function named countPos that reads integer values from standard input until there are none left and returns the number that are positive. The function must not use a loop of any kind.

Answers

Answer:Here is the method countPos    

 static int countPos(Scanner input){ //method that takes a reference to a Scanner object

  int counter=0;  // to count the positive integers  

  int number; //to store each integer value

  if(input.hasNextInt()){ //checks if next token in this scanner input is an integer value

      number=input.nextInt(); //nextInt() method of a Scanner object reads in a string of digits and converts them into an int type and stores it into number variable

      counter=countPos(input); //calls method by passing the Scanner object and stores it in counter variable

      if(number>0) //if the value is a positive number

          counter++;    } //adds 1 to the counter variable each time a positive input value is enountered

  else    { //if value is not a positive integer

      return counter;    } //returns the value of counter

  return counter; } //returns the total count of the positive numbers

Explanation:

Here is the complete program:

import java.util.Scanner; //to take input from user

public class Main { //class name

//comments with each line of method below are given in Answer section

static int countPos(Scanner input){

  int counter=0;

  int number;

  if(input.hasNextInt()){

      number=input.nextInt();

      counter=countPos(input);

      if(number>0)

          counter++;    }

  else    {

      return counter;    }

  return counter; }

public static void main(String[] args) { //start of main function

      System.out.println("Number of positive integers: " + countPos(new Scanner(System.in)));  } } //prints the number of positive integers by calling countPos method and passing Scanner object to it

The program uses hasNextInt method that returns the next token (next input value) and if condition checks using this method if the input value is an integer. nextInt() keeps scanning the next token of the input as an integer. If the input number is a positive number then the counter variable is incremented to 1 otherwise not. If the use enters anything other than an integer value then the program stops and returns the total number of positive integers input by the user. This technique is used in order to avoid using any loop. The program and its output is attached

Explanation:

what is information richness

Answers

Information Richness is the ability of information to change understanding within a time interval.

Hope it helps. Have a great day.

Brainliest would be greatly appreciated.

___________________________________________________________

#SaveTheEarth

#SpreadTheLove

- Mitsu JK

Write a program that uses the Purchase class in 5.13. Set the prices to the following: Oranges: 10 for $2.99 Eggs: 12 for $1.69 Apples: 3 for $1.00 Watermelons: $4.39 each Bagels: 6 for $3.50 Set the purchased quantity to the following: 2 dozen oranges, 2 dozen eggs, 20 apples, 2 watermelons, 1 dozen bagels Display the total cost of the bill

Answers

Answer:

Explanation:

The following program is written in Java. Using the program code from Purchase class in 5.13 I created each one of the fruit objects. Then I set the price for each object using the setPrice method. Then I set the number of each fruit that I intended on buying with the setNumberBought method. Finally, I called each objects getTotalCost method to get the final price of each object which was all added to the totalCost instance variable. This instance variable was printed as the total cost of the bill at the end of the program. My code HIGHLIGHTED BELOW

//Entire code is in text file attached below.

//MY CODE HERE

       DecimalFormat df = new DecimalFormat("0.00");

       oranges.setPrice(10, 2.99);

       oranges.setNumberBought(2*12);

       eggs.setPrice(12, 1.69);

       eggs.setNumberBought(2*12);

       apples.setPrice(3, 1);

       apples.setNumberBought(20);

       watermelons.setPrice(1, 4.39);

       watermelons.setNumberBought(2);

       bagels.setPrice(6, 3.50);

       bagels.setNumberBought(12);

       totalCost = oranges.getTotalCost() + eggs.getTotalCost() + apples.getTotalCost() + watermelons.getTotalCost() + bagels.getTotalCost();

       System.out.println("Total Cost: $" + df.format(totalCost));

   }

}

Why is it important to think about the programming language to use?

Answers

Answer:

"The choice of programming language determines the type of game you can make."

Explanation:

Programming language enables us to write efficient programs and develop online things based on the certain type of code.

Q3: State whether each of the following is true or false. If false, explain why. 1. A generic method cannot have the same method name as a nongeneric method. 2. All generic method declarations have a type-parameter section that immediately precedesthe method name. 3. A generic method can be overloaded by another generic method with the same methodname but different method parameters. 4. A type parameter can be declared only once in the type-parameter section but can appearmore than once in the method’s parameter list. 5. Type-parameter names among different generic methods must be unique. 6. The scope of a generic class’s type parameter is the entire class except its staticmembers.

Answers

Answer:

3

Explanation:

Which option is the default configuration of the Junk Email Options in Outlook 2016?

No Automatic Filtering
Low
High
Safe Lists Only

Answers

Answer:

No Automatic Filtering

Answer:

NO automatic filtering

Explanation:

i took the quiz

PLZZ HELP!!!
Select the correct answer.
Brian’s team has built a new application based on the client’s requirements. They will deploy this application in multiple locations on the client side. Brian is unsure about the hardware and software specifications at the client side. Which option will help him best solve this issue?
A.
creating multiple test scripts
B.
automating test scripts
C.
creating multiple test plans
D.
creating multiple test environments
E.
communicating with the development team

Answers

Answer: Option D creating muiltiple test enviroments

Explanation: I had the same question and I hope this helps ( :

The option that will help Brain best solve this issue is by creating multiple test environments.

What is the specification of software?

A software requirements specification (SRS) is known to be a type of requirement that are often written in a document that tells more about what the software can do.

Hence in the above scenario, what will help help Brain best solve this issue is by creating multiple test environments where the client can see a demonstration and be convince in getting the product.

Learn more about application from

https://brainly.com/question/24847617

the process of preparing and setting up a software on a computer is called​

Answers

Answer:

installation

Explanation:

Installation (or setup) of a computer program (including device drivers and plugins), is the act of making the program ready for execution.

they will wash the car change into tag question​

Answers

Answer:

They will wash the car, won't they?

Explanation:

A tag question usually comes after an independent clause. The tag question is most times attached with the intent of affirming the statement made in the independent clause. Our independent clause in the answer above is; "They will wash the car". The tag question, "Won't they?" is meant to affirm that statement.

Another example is, "They are going to school, aren't they?" In this example also, the independent clause makes a sentence that is to be confirmed by the tag question.

Does anyone have the answers to edhesive 4.2 lesson practice I’ve been stuck on it for like 3 months

Answers

Answer:

1. 5, 10

2. 5, 7, 9, 11

3. 21

4. 10

Explanation:

What do y’all think are the pros and cons to using technology?

Answers

Answer:

Explanation:

pros. convenient, easy to use, and educational  cons. addictive, mentally draining, and creates a social divide.

When using for loops and two-dimensional arrays, the outside loop moves across the ___________ and the inside loop moves across the ___________.

indexes, elements

columns, rows

elements, indexes

rows, columns

Answers

Answer: rows, columns

Explanation: :)

Mattias's friend asked him to critique his presentation about gorillas. Mattias noticed that there weren't any images of gorillas. What feedback can Mattias give to improve his friend's presentation?
a I like your title, but did you not think to add pictures of gorillas?
b It's ok, but it would be better if I just added pictures to your presentation.
c Really great information, but I think adding a picture of a gorilla would be great.
d You're missing a gorilla picture. Add one.

Answers

Answer:

c

Explanation:

Answer:B

Really great information, but I think adding a picture of a gorilla would be great.

Explanation:

Mattias's friend asked him to critique his presentation about gorillas. Mattias noticed that there weren't any images of gorillas. What feedback can Mattias give to improve his friend's presentation?

Group of answer choices

A)You're missing a gorilla picture. Add one.

B)Really great information, but I think adding a picture of a gorilla would be great.

C)I like your title, but did you not think to add pictures of gorillas?

D)It's ok, but it would be better if I just added pictures to your presentation.

My teacher just asked, "What did you learn about coding and how can it help u through life." CAN SOMEONE PLZ ANSWER BC I DONT KNOW.​

Answers

Answer:

Coding is becoming a big thing in America because more and more jobs are on the computer, because they future is tech.

Explanation:

i dont know something like tht

Consider the following argument: Any piece of software that is in the public domain may be copied without permission or fee. But that cannot be done in the case of software under copyright. So, software under copyright must not be in the public domain. The conclusion of the argument is:

Answers

Answer:

"software under copyright must not be in the public domain"

Explanation:

The conclusion of his argument is "software under copyright must not be in the public domain". This combines the two premises that were stated before it in order to form a logical outcome based on the premises. In the case of logic, this would basically be an

IF A and IF B, Then C

type of logic, in which A is "Public Domain Work can be copied", B is "Software under Copyright cannot be copied", and C is the conclusion which would be "software under copyright must not be in the public domain"

Read the following statements and use the drop-down menus to identify which statements are
conditional statements.
I am thinking about going to college.
I plan to go to college if my grades are good enough.
If my grades are very good, then I will select a college that offers scholarships.
I plan to visit several colleges to see what they offer and what the living situations look like.
If I do not qualify for any scholarships, then I will apply for student loans.
I will also start working a part-time job to help pay for college.

Answers

Answer:

I am thinking about going to college.

✔ not a conditional statement

I plan to go to college if my grades are good enough.

✔ conditional statement

If my grades are very good, then I will select a college that offers scholarships.

✔ conditional statement

I plan to visit several colleges to see what they offer and what the living situations look like.

✔ not a conditional statement

If I do not qualify for any scholarships, then I will apply for student loans.

✔ conditional statement

I will also start working a part-time job to help pay for college.

✔ not a conditional statement

If I go to college, then my parents will let me take the extra car with me.

✔ conditional statement

If I do not go to college and stay home, then my parents want me to start paying rent.

✔ conditional statement

Answer:

These are correct!

I am thinking about going to college.  ✔ not a conditional statement  

I plan to go to college if my grades are good enough. ✔ conditional statement   

If my grades are very good, then I will select a college that offers scholarships. ✔ conditional statement  

I plan to visit several colleges to see what they offer and what the living situations look like. ✔ not a conditional statement  

If I do not qualify for any scholarships, then I will apply for student loans. ✔ conditional statement 

I will also start working a part-time job to help pay for college. ✔ not a conditional statement  

If I go to college, then my parents will let me take the extra car with me. ✔ conditional statement  

If I do not go to college and stay home, then my parents want me to start paying rent. ✔ conditional statement

Explanation:

They are correct! I answered them and got them all right!

Draw a data flow diagram that indicates the condition and factors that must be satisfied before a customer request for goods can be granted from a factory

Answers

Skies in here and the beach and

personal computer is the rise of what?​

Answers

Answer:

Overuse injuries of the hand.

Obesity.

Muscle and joint problems.

Eyestrain.

Behavioural problems including aggressive behaviour.

Introduction to Programming Workbook
Draw flowchart to find the largest among threu different numbers entered by a user

Answers

Haije jiôes 1w mòé si aimx

Write a Python function that takes as input a list, A, and returns two lists L and G. L constains all numbers in A, which are not A[0] and are less than or equal to A[0]. G contains all numbers in A, which are not A[0], and are greater than A[0].

Answers

Answer:

In Python:

def split(A):

   L=[]; G=[]

   for i in range(1,len(A)):

       if (A[i] != A[0] and A[i] < A[0]):

           L.append(A[i])

       if (A[i] != A[0] and A[i] > A[0]):

           G.append(A[i])

   return L, G

Explanation:

This defines the function

def split(A):

This initializes the L and G lists

   L=[]; G=[]

This iterates through the original list A

   for i in range(1,len(A)):

This populates list L using the stated condition

       if (A[i] != A[0] and A[i] < A[0]):

           L.append(A[i])

This populates list G using the stated condition

       if (A[i] != A[0] and A[i] > A[0]):

           G.append(A[i])

This returns the two lists L and G

   return L, G

Digital computers use a........ system to encode date and programs.

Answers

Answer:

Digital computers use a binary system to encode date and programs.

For questions 3-6, consider the following two-dimensional array:

undervalue

will

knitting

pretzel

realize

honey

planetary

bandana

iron

employment

effort

fabric


What word is in [0][1] ?


Flag this Question
Question 41 pts
What word is in [1][1] ?

Flag this Question
Question 5
What word is in [3][2] ?

Flag this Question
Question 6
What word is in [2][1] ?

Answers

Answer:

3. Will

4. Realize

5. Fabric

6. Bandana

Realize is in is in [1][1], Fabric is in [3][2], Bandana is in [2][1] . Arrays inside of arrays are what are known as two-dimensional arrays.

What is two-dimensional array?

Arrays inside of arrays are what are known as two-dimensional arrays. 2D arrays, which are made up of rows and columns, are constructed as metrics. To create a database that resembles the data structure, 2D arrays are frequently used.

You may store a large amount of data using 2d arrays at once, which can then be supplied to as many different functions as necessary. Two indices are used to refer to the position of the data element in two-dimensional or multi-dimensional arrays. Row and column are the two dimensions indicated by the name. Realize is in is in [1][1], Fabric is in [3][2], Bandana is in [2][1] .

Therefore, realize is in is in [1][1], Fabric is in [3][2], Bandana is in [2][1].

To know more about two-dimensional array, here:

https://brainly.com/question/30463245

#SPJ3

PLZZZ HELP
Select the correct answer.
A company utilizes a specific design methodology in the software design process. They utilize concepts of encapsulation in design. Which design methodology would they be using?
A.
structured design
B.
modular design
C.
object-oriented design
D.
rapid application development
E.
use-case design

Answers

Answer:

C is object-oriented design

Why data mining is crucial for the success of a business, explain with examples

Answers

Answer:

For businesses, data mining is used to discover patterns and relationships in the data in order to help make better business decisions. Data mining can help spot sales trends, develop smarter marketing campaigns, and accurately predict customer loyalty.

PLEASEE HELPP.... QUESTION... how does coding impact your life​

Answers

Answer: It allows us to do everyday tasks on the internet

Explanation: We wouldn’t be able to email, research, etc without coding!

It helps us use things such as the internet, TVs and many other things coding is a Vidal asset in are everyday life.
Other Questions
They're Made Out of Meat book4. What does marking the sector as "unoccupied" reveal about the two speakers? (Paragraph 45)Required to answer. Single choice.a. They frequently erase official records of new sentient beings.b. They do not want to interact with beings that are made out of meat.c. They reject the idea that the beings made out of meat are sentient.d. They Think the beings made out of meat are too dangerous.5.Which detail from the text best shows the speakers' disregard for the beings made out of meat?Required to answer. Single choice.a. "they've been trying to get in touch with us for almost a hundred of their years." (paragraph 23)b. "They can travel to other planets in special meat containers..." (paragraph 39)c. "What's there to say? 'Hello, meat. How's it going?'" (paragraph 38)d. "I imagine it wants to explore the universe, contact other sentiences, swap ideas and information." (paragraph 25) Question below in image 17. RNA contains instructions to make a specific protein and is produced from genetic information in the nucleus of the cell. Which best identifies this process? A mutation B replication C translation D transcription According to Article 2 of the Constitution, what are the qualifications to be President? (List them) please help will give all my brainly points What does it mean if a source wants to remain off-the-record? Why might off-the-record information be helpful to a reporter? 1) New York City is a sprawling urban city with historical landmarks and modern skyscrapers. 2) Partially because of the variety of cultureand art and opportunity for business, it is the most densely populated city in the United States. 3) In addition to being densely populated, New York City also is very ethnically diverse with a large percentage of its population being of Chinese and Hispanic backgrounds. 4) All densely populated cities must be ethnically diverse. 5)Based on the growth of the last ten years, the Census Bureau predicts that New York City will continue to grow in upcoming years.Which sentence demonstrates an error in logic?sentence 2sentence 3sentence 4sentence 5 Question 3Based on your observations, what can you conclude about the relationship between the area of the sector, the measure of the corresponding central angle, and the are of circle? HELP ME PLS I WILL GIVE 25 POINTS!! we're religion and government connected? parents also need to make sure that regulate the use of their child's fault make sure it's not being misused.what does regulate mean in this sentences? A reduce B stop Cset D supervise A quiz consists of 570 true or false questions. If the student guesses on each question, what is the mean number of correct answers? 1. Find the area13 ft3 ft 2. What types of things does a hospitality manager do? 3. What courses or information would be helpful for a hospitality manager? please help Emilia scored x points in a game . Sarah scored 3 less than 5 times as many points as Emilia . Together, Emilia and Sarah scored a total of 39 points . How many points did Emilia score? please help me!!!! ily if u dooooo PromptPLEASE HELP!!( 5 paragraph essay )Writing prompt: Write an argumentative essay for or against maintaining traditional coming-of-age ceremonies, such as a quinceaera Which table shows exponential decay 6.If Addison types at a constant rate of 2 pages per hour, how many hours will it take totype a paper that is 5 pages long?Immersive Reader(20 Points)0.4 hour2.5 hours5 hours10 hours What are two characteristics of S waves? Calculate the value of x.