Please read the details of the Selection Sort algorithm: Selection Sort Selection Sort Analysis
public class TimedComputation { /* This program performs some mathematical computations and displays the results. It then reports the number of seconds that the computer spent on this task. */ public static void main(String[] args) { long startTime; // Starting time of program, in milliseconds. long endTime; // Time when computations are done, in milliseconds. double time; // Time difference, in seconds. startTime = System.currentTimeMillis(); // ::::::::: // PUT YOUR SORTING CODE HERE // ::::::::: endTime = System.currentTimeMillis(); time = (endTime - startTime) / 1000.0; System.out.print("\nRun time in seconds was: "); System.out.println(time); } // end main() } // end class TimedComputation
Enter size of data[]: 3 Enter 3 integers: 1 2 3 Your Data 1 2 3 Copy Data 1 2 3 Reverse Data 3 2 1