Question: Java only please I need help figuring out how to write code so that it is using selection sort and not bubble sort 7 import

Java only please

I need help figuring out how to write code so that it is using selection sort and not bubble sort

7 import java.text.SimpleDateFormat; 8 import java.util.Calendar; 9 import java.util.Date; 10 import java.util.Random; 11 import java.util.Scanner; 12 import java.util.concurrent.TimeUnit; 13 //class definition 14 public class BubbleSortTech { 15 //variable declaration 16 long runtime=0; 17 Calendar cal1,cal2; 18 SimpleDateFormat sdf; 19 int arr[]; 20 Random rand; 21 //constructor 22 public BubbleSortTech(int n) { 23 sdf = new SimpleDateFormat("HH:mm:ss"); 24 rand=new Random(); 25 arr=new int[n]; 26 //getting time before completion 27 cal1 = Calendar.getInstance(); 28 Date start_time= cal1.getTime(); 29 for(int j=1;j<1000;j++){ 30 for(int i=0;i arr[j+1]) 54 { 55 // swap temp and arr[i] 56 int temp = arr[j]; 57 arr[j] = arr[j+1]; 58 arr[j+1] = temp; 59 } 60 } 61 //displaying the array 62 public void display(){ 63 for(int i=0;i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!