Make sure that I can be able to merge two sorted arrays into one. For some reason
Fantastic news! We've Found the answer you've been seeking!
Question:
Make sure that I can be able to merge two sorted arrays into one. For some reason my Eclipse is not running my Java programs. So I need help to make sure everything runs smoothly
Transcribed Image Text:
eclipse-workspace - Test2/src/Test2/Test2.java - Eclipse IDE File Edit Source Refactor Navigate Package Explorer X Grossincomes Homework1 Homework2 > JRE System Library [JavaSE-17] src homework2 > Homework2.java HW1 Loop LoopExercise > JRE System Library [JavaSE-17] src loopexercise LoopExercise.java > module-info.java marathonrace MyBasicArrayList > JRE System Library [JavaSE-17] src mybasicarraylist MyBasicArrayList.java MyFactiorial2 MyFactorial Myinput MyMenu MyMenu1 New Search > JRE System Library [JavaSE-17] src lincoln > Lincoln.java module-info.java SquareOverloading Student Test2 > JRE System Library [JavaSE-17] src Test2 > Test2.java Tact2 Project Run T Window Help *Homework2.java 1 package Test2; Test2.java X *Test3.java ArrayListPrint.java ArrayCopy.java MyBasicArrayList.java 2 3 public class Test2 { 4 50 69 7 public static void main(String[] args) { int[] list = {7,8,7,10,11,6,3,8,19,17}; mergeSort (list);B for (int i = 0; i < list.length; i++) System.out.print(list[i] + "); public static void mergeSort (int [ ] list) { 8 9 10 } 11 13 1234567 120 if (list.length > 1) { int[] firstHalf = new int[list.length / 2]; System.arraycopy(list, 0, firstHalf, , list.length / 2); mergeSort(firstHalf); int secondHalfLength = list.length - list.length / 2; int[] second Half = new int[secondHalfLength]; System.arraycopy(list, list.length / 2, secondHalf, 0, secondHalfLength); mergeSort(secondHalf); 17 18 19 20 21 22 23 24 } 25 } merge(firstHalf, secondHalf, list); 27 260 public static void merge(int[] list1, int[] list2, int[] temp) { int current1 = 0; 28 int current2 = 0; 29 int current3 = 0; 30 31 32 while (current1 < list1.length && current2 < list2.length) { if (list1[current1] < list2[current2]) temp[current3++] = list1[current1++]; 33 else 34 temp[current3++] = list2[current2++]; 35 } 36 37 38 39 while (current1 < list1.length) temp[current3++] list1[current1++]; while (current2 < list2.length) temp[current3++] = list2[current2++]; 40 41 } 42} 43 | = Problems @Javadoc Declaration Console X Coverage New_configuration [Java Application] C:\Users\jonat\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.3.v20220515-1416\jre\bin\javaw.exe (Jul 10, 2022, 5:21:38 PM 5:21:38 PM Error: Could not find or load main class eclipse-workspace - Test2/src/Test2/Test2.java - Eclipse IDE File Edit Source Refactor Navigate Package Explorer X Grossincomes Homework1 Homework2 > JRE System Library [JavaSE-17] src homework2 > Homework2.java HW1 Loop LoopExercise > JRE System Library [JavaSE-17] src loopexercise LoopExercise.java > module-info.java marathonrace MyBasicArrayList > JRE System Library [JavaSE-17] src mybasicarraylist MyBasicArrayList.java MyFactiorial2 MyFactorial Myinput MyMenu MyMenu1 New Search > JRE System Library [JavaSE-17] src lincoln > Lincoln.java module-info.java SquareOverloading Student Test2 > JRE System Library [JavaSE-17] src Test2 > Test2.java Tact2 Project Run T Window Help *Homework2.java 1 package Test2; Test2.java X *Test3.java ArrayListPrint.java ArrayCopy.java MyBasicArrayList.java 2 3 public class Test2 { 4 50 69 7 public static void main(String[] args) { int[] list = {7,8,7,10,11,6,3,8,19,17}; mergeSort (list);B for (int i = 0; i < list.length; i++) System.out.print(list[i] + "); public static void mergeSort (int [ ] list) { 8 9 10 } 11 13 1234567 120 if (list.length > 1) { int[] firstHalf = new int[list.length / 2]; System.arraycopy(list, 0, firstHalf, , list.length / 2); mergeSort(firstHalf); int secondHalfLength = list.length - list.length / 2; int[] second Half = new int[secondHalfLength]; System.arraycopy(list, list.length / 2, secondHalf, 0, secondHalfLength); mergeSort(secondHalf); 17 18 19 20 21 22 23 24 } 25 } merge(firstHalf, secondHalf, list); 27 260 public static void merge(int[] list1, int[] list2, int[] temp) { int current1 = 0; 28 int current2 = 0; 29 int current3 = 0; 30 31 32 while (current1 < list1.length && current2 < list2.length) { if (list1[current1] < list2[current2]) temp[current3++] = list1[current1++]; 33 else 34 temp[current3++] = list2[current2++]; 35 } 36 37 38 39 while (current1 < list1.length) temp[current3++] list1[current1++]; while (current2 < list2.length) temp[current3++] = list2[current2++]; 40 41 } 42} 43 | = Problems @Javadoc Declaration Console X Coverage New_configuration [Java Application] C:\Users\jonat\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.3.v20220515-1416\jre\bin\javaw.exe (Jul 10, 2022, 5:21:38 PM 5:21:38 PM Error: Could not find or load main class
Expert Answer:
Related Book For
Sales Force Management Leadership Innovation Technology
ISBN: 9781138951723
12th Edition
Authors: Mark W. Johnston, Greg W. Marshall
Posted Date:
Students also viewed these programming questions
-
(a) Sets containing integers can be represented as int list values. Consider two such representations called unordered and ordered. In the former elements can appear in any order; in the latter...
-
Python and most Python libraries are free to download or use, though many users use Python through a paid service. Paid services help IT organizations manage the risks associated with the use of...
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
The data file arch.gdt contain monthly stock price indices return of U.S. Nasdaq (NR). The data are recorded monthly beginning in 1988:01 and ending in 2015:12. Question 1. i) (Bonus) Consider the...
-
Now suppose the supply schedule is instead as follows: (A)What are the equilibrium price and equilibrium quantity in the absence of a tax? (B)What are the equilibrium price and equilibrium quantity...
-
Bleakhouse Bakers produces breads and pastries. Bleakhouse is considering introducing a new breakfast item. They estimate materials costs at $4.00 per dozen and overhead costs of $2.02 per dozen....
-
Consider a payoff \(C\) that will occur in 2 years, taking one of the three possible values \(C_{0}, C_{1}, C_{2}\). The short rate lattice for these 2 years is shown in Figure 16.16, with \(d_{i...
-
Using Figure 7-5 as an example, redraw Figure 7-13 using an enterprise information system that processes a shared database. Explain the advantages of this system over the paper-based system in Figure...
-
Presented below is information related to Sunbuck's Coffee Club for its fiscal year ending April 30, 2023. During the year, the Board of Directors decided to discontinue the operations of its entire...
-
Based on the NPV and IRR investment criteria, should your company introduce a new candy flavor? 1) Should the cost of a marketing survey be included in your decision? Why or why not? 2) Calculate the...
-
If i weigh 130 pounds and i ate a dunkin donutsboston kreme donut (270 kcal) - how many miles do i have to run to burn off the energyequivalent to the donut? please show all work with units so i can...
-
While traveling to Europe, Phelan exchanged 250 US dollars for euros. He spent 150 euros on his trip. After returning to the United States he converts his money back to US dollars. How much of the...
-
Social and personal resources students carry with them are part of what form of community cultural wealth?
-
1. There was a payroll of $68,100 paid on 3 January; this covered the period of 30 December to 3 January. Write the adjusting entry for this. I know that the debit is to wages expense and the credit...
-
Produce a persuasive report for a company of your choice, with arguments for why they should produce a sustainability report. You will be expected to Prepare a 2500 words persuasive report addressed...
-
What are the seven key elements of a system, and what role does each element play in describing a system?
-
Modify the counter from Exercise 5.44 such that the counter will either increment by 4 or load a new 32-bit value, D, on each clock edge, depending on a control signal Load. When Load = 1, the...
-
Eq. 7.36a is written for the conservation of momentum in y direction. Obtain Eq. 7.36-b wherein the stream function is independent variable. Eq. 7.36(a,b) y - v v +(1-y/R)v- + momentum: u u R-y + R P...
-
Show that the derivative of the boundary layer edge velocity is given by Eq. 7.64 for the figure given below. Eq. 7.64 M>>1 Ue dx R dy/dx = 1/R
-
Using Maslen method, find the approximate value of pressure and density at the junction of the sphere and the cone of Problem 7.29 at Mach number 8. Problem 7.29 An empirical way to determine shock...
Study smarter with the SolutionInn App