The language used here is in Java. Please answer the question in the screenshot. Please use the code below as a base.
import java.util.*;
class SortingPack {
// just in case you need tis method for testing
public static void main(String[] args) {
// something
}
// implementation of insertion sort
// parameters: int array unsortedArr
// return: sorted int array
public static int[] insertionSort(int[] unsortedArr) {
// to be removed return unsortedArr;
}
// implementation of quick sort
// parameters: int array unsortedArr
// return: sorted int array
public static int[] quickSort(int[] unsortedArr) {
// to be removed return unsortedArr;
}
// implementation of merge sort
// parameters: int array unsortedArr
// return: sorted int array
public static int[] mergeSort(int[] unsortedArr) {
// to be removed return unsortedArr;
}
// you are welcome to add any supporting methods
}
Step by stepSolved in 2 steps with 1 images
- Number 5arrow_forwardThis is a debugging question - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Code - // This class determines the logarithm of a number public class DebugTwelve1 { public static void main(String[] args) throws ArithmeticException { double num = -8.8, result. try { if(num <= 0) throw(new ArithmeticException()); result = Math.log(num); System.out.println("Result is " + result); } catch() { System.out.println("Can't take logarithm for value of zero or lower"); } } }arrow_forwardimport java.util.Arrays; import java.util.Random; public class Board { /** * Construct a puzzle board by beginning with a solved board and then * making a number of random moves. That some of the possible moves * don't actually change what the board looks like. * * @param moves the number of moves to make when generating the board. */ public Board(int moves) { throw new RuntimeException("Not implemented"); } The board is 5 X 5. You can add classes and imports like rand.arrow_forward
- Using the code in the image provided: Implement a method called summation which adds two integers and returns their sum. INPUT: The first line of input contains an integer a. The Second Line of input containes and integer b. OUTPUT: Print the result which is the sum of a and b.arrow_forwardConvert uml to java code with main methodarrow_forwardConsider the following piece of code. (The numbers on the left margin denote line numbers.) line#01 public class funcRef {02 private int n;03 public funcRef (int m) {n = m;}04 public static void func (funcRef t) {t.n++;}05 public static void main (String [] args) {06 funcRef t1, t2;07 t1 = new funcRef(20);08 t2 = t1;09 System.out.print(t2.n);10 func(t1);11 System.out.print(t2.n);12 func(t1);13 System.out.print(t1.n);14 func(t2);15 System.out.print(t1.n);16 func(t2);17 System.out.print(t1.n);18 System.out.print(t1.n);19 return;20 }21 } Out of the following, tick the true statements and leave the false statements unticked.(More than one of the statements could be true. You get full marks only for marking all the statements correctly. There are no partial marks.) A. The output of the program will be 202022222222. B. When func(t1) is called in line…arrow_forward
- Please help me with the below using java. Please also comment the code (explai. What each li e is doing). Please make sure both codes are completed using recursionarrow_forwardPYTHON: This exercise is a variation on "instrumenting" the recursive Fibonacci program to better understand its behavior. Write a supporting method that counts how many times the fib function is called to compute fib (n) where n is a user input. Hint: To solve this problem, you need an accumulator variable whose value "persists" between calls to fib. You can do this by making the count an instance variable of an object. Create a FibCounter class with the following methods: _init_(self) Creates a new FibCounter, setting its count instance variable to 0. getCount(self) Returns the value of count. fib(self, n) Recursive function to compute the nth Fibonacci number. It increments the count each time it is called. resetCount(self) Sets the count back to 0.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY