Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program named SortingAlgorithm.java and implement the following sorting algorithm: public static void bubbleSort(int[] arr){} public static void selectionSort(int[] arr){} public static void insertionSort(int[]

Write a program named SortingAlgorithm.java and implement the following sorting algorithm: public static void bubbleSort(int[] arr){} public static void selectionSort(int[] arr){} public static void insertionSort(int[] arr){} Download the data file and use each of these sorting algorithms to sort the data. Record the sorting time of each algorithm in either millisecond or nano time and tabulate the results as follows in a text file (options: can implement text writer or just copy and paste result into a text file in the format below): bubble selection insertion ----------------------------------------------------------- data1(m) 1 2 2 data2(n) 89956 589456 859 ... ------------------------------------------------------------ (m) for millisecond (n) for nano time To test the data file, you need to download your program and data file. Then, implement file reader to test your sorting algorithm in a local computer. 

data1.data

2 10 2 20 198 116 99 48 202 121 105 95 114 96 158 127 184 155 146 78 165 196

 The first line in the data file represents two numbers N and M, followed by N line and each line contains M integers. Use those numbers to create an array and use each of the sorting method to test the time spend to sort the numbers. example: from data1.data: line 1: 2 10 where 2*10 = 20 int arr []; arr = new Int [20]; arr = {20 datas from line 2 and 3 of data1.data}; Additionally, implement a recursive method to calculate the fibonaci numbers for 10, 80, 180, 280. In the same text file as above, record the results and time as follows: fibonaci(10) fibonaci(80) fibonaci(180) fibonaci(280) Result: Time Spent:

Did you encountered any errors for the fibonaci? If so, how did you solved it?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started