Solve this error 8023- Ed Lessons V Next ds ng Description Feedback TESTCASES testExampleData X Failed:
Fantastic news! We've Found the answer you've been seeking!
Question:
Solve this error
Transcribed Image Text:
8023- Ed Lessons V Next ds ng Description ✓ Feedback TESTCASES testExampleData X Failed: At least one swap was incorrect. ==> expected: <[12, 23, 66, 45, 87, 19] [12, 19, 66, 45, 87, 23] [12, 19, 23, 45, 87, 66] [12, 19, 23, 45, 66, 87]> but was: <After swap, array is [23, 45, 66, 12, 87, 19] After swap, array is [12, 45, 66, 23, 87, 19] After swap, array is [12, 23, 66, 45, 87, 19] After swap, array is [12, 19, 66, 45, 87, 23] After swap, array is [12, 19, 45, 66, 87, 23] After swap, array is Unbounded Selection Sort (Extension Exercise) + SelectionSort.java 1 import java.util.Arrays; 2 //Importing packages 3 public class SelectionSort{ 4 private static void printArray (int[] a) { //Function to print array 5 m.out.println (Arrays.toString(a)); [12, 19, 23, 66, 87,45] After swap, array is [12.19. 23. 45. 87.661 2/5 passed 6 Sys 7 //Dispalys result to user 8} 9 10 public static int[] selectionSort (int[] data) { 11 //Function that performs sorting operation 12 for (int i=0; i<data.length; i++) { 13 for (int j =i+1; j<data.length; j++) { 14 if(data[i]>data[j]) { 15 //Checking for order 16 int temp = data[i]; 17 data[i] = data[j]; /home/SelectionSort java Spaces: 4 (Auto) Console Terminal After swap, array is [33, 45, 93, 55] After swap, array is [33, 45, 55, 93] After sorting the array is: [33, 45, 55, 93] Challenge Program exited with code 0 20°C Cloudy@ 8023- Ed Lessons V Next ds ng Description ✓ Feedback TESTCASES testExampleData X Failed: At least one swap was incorrect. ==> expected: <[12, 23, 66, 45, 87, 19] [12, 19, 66, 45, 87, 23] [12, 19, 23, 45, 87, 66] [12, 19, 23, 45, 66, 87]> but was: <After swap, array is [23, 45, 66, 12, 87, 19] After swap, array is [12, 45, 66, 23, 87, 19] After swap, array is [12, 23, 66, 45, 87, 19] After swap, array is [12, 19, 66, 45, 87, 23] After swap, array is [12, 19, 45, 66, 87, 23] After swap, array is Unbounded Selection Sort (Extension Exercise) + SelectionSort.java 1 import java.util.Arrays; 2 //Importing packages 3 public class SelectionSort{ 4 private static void printArray (int[] a) { //Function to print array 5 m.out.println (Arrays.toString(a)); [12, 19, 23, 66, 87,45] After swap, array is [12.19. 23. 45. 87.661 2/5 passed 6 Sys 7 //Dispalys result to user 8} 9 10 public static int[] selectionSort (int[] data) { 11 //Function that performs sorting operation 12 for (int i=0; i<data.length; i++) { 13 for (int j =i+1; j<data.length; j++) { 14 if(data[i]>data[j]) { 15 //Checking for order 16 int temp = data[i]; 17 data[i] = data[j]; /home/SelectionSort java Spaces: 4 (Auto) Console Terminal After swap, array is [33, 45, 93, 55] After swap, array is [33, 45, 55, 93] After sorting the array is: [33, 45, 55, 93] Challenge Program exited with code 0 20°C Cloudy@
Expert Answer:
Answer rating: 100% (QA)
It seems like youve posted a code snippet for a Java program implementing the selection sort algorit... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
A database is to be made to store information about a catalogue of CDs. Information to be stored about each CD includes title, price, genre, and a list of tracks. Each CD will also have an artist,...
-
Rank the following in order of increasing angular speed: an automobile tire rotating at 2.00 103 deg/s, an electric drill rotating at 400.0 rev/min, and an airplane propeller rotating at 40.0 rad/s.
-
Various activities at Reservations Online, a hotel reservation call centre, are listed below: Required: 1. Classify each activity as unit-level, batch-level, product-level, customer- level, or...
-
Some of the prior interviews suggest that the company is so cheap that they wont pay people what they are worth. Have you had similar experiences?
-
Mini- Case: Going- Concern Reporting. Refer to the mini-case GM: Running on Empty on page C11 and respond to questions 1 6. 1. Reviewing GMs financial information in GM Exhibit 1 and its stock price...
-
1. There are many market disruptions in the news today. (If you get stuck, on the last slide of the PowerPoint, I've given you 2 examples.) Choose any disruptor in the news and, (a) summarize the...
-
Design the 4-to-1 MUX two ways Write a Verilog module called mux4to1 to implement 4-to-1 multiplexer using functional descriptions and if-else blocks. Write another Verilog module called...
-
Vic and Wanda are married and file a joint return for the current year. They have no dependents and they take the standard deduction. Their taxable income is $800,000 (including their standard...
-
2. For the following T(n) find values of no and c such that cn is larger than T(n) for all n larger than no. T(n) = n - 5n + 20n - 10
-
3) What is the highest 8-bit number? (a) In binary: (b) In hex: 4) What is the highest 16-bit number? (a) In binary: (b) In hex: 5) Convert binary 100000 to decimal and hex. (a) Decimal: (b) Hex: 6)...
-
The factorial function is defined as: 0!= 1 n! 1-2-3. (n-2)(n-1) n a) Write a C++ function that will return n. The input to the function will be an integer n and the function will return n! io single...
-
1) a) b) c) d) What is the order of the following functions: f(x) = 5 f(x) = x + 10 f(x)= =+ ==+ log (x) 1000 f(n)= n! + na Just give the order, you do not have to provide a proof. If you are not...
-
Which of the following parameters are used to differentiate methods signatures? (select all that apply) Number of parameters Types of the parameters Order of the parameter types None of the above
-
Assess AccorHotels' business strategy. How effective do you think it is for competing against Airbnb? What else should AccorHotels do in order to enhance its competitiveness against digital...
-
Refer to the table to answer the following questions. Year Nominal GDP (in billions) Total Federal Spending (in billions) Real GDP (in billions) Real Federal Spending (in billions) 2000 9,817 578...
-
Outline the stages of union-management negotiations.
-
Why is the issue of bargaining in good faith particularly important in negotiations for a first collective agreement?
-
Why is the CLC called the union of unions?
-
The relativity of simultaneity. Two clocks are placed at rest on the \(x^{\prime}\) axis of the primed frame, clock A at \(x^{\prime}=0\) and clock B at \(x^{\prime}=L_{0}\). They are therefore a...
-
A primed frame moves at \(V=(3 / 5) c\) relative to an unprimed frame. Just as their origins pass, clocks at the origins of both frames read zero, and a flashbulb explodes at that point. Later, the...
-
Synchronized clocks A and B are at rest in our frame of reference, a distance five light-minutes apart. Clock \(\mathrm{C}\) passes \(\mathrm{A}\) at speed (12/13) \(c\) bound for \(\mathrm{B}\),...
Study smarter with the SolutionInn App