DescendingSortsDriver

DescendingSortsDriver - create random numbers for(int i=0...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // DescendingSortsDriver.java Author: Lewis/Loftus // // Solution to Programming Project 6.3 //******************************************************************** / import java.util.Random; i public class DescendingSortsDriver { private static final int NUM = 50, MAX = 100; //----------------------------------------------------------------- // Demonstrates the descending sorts //----------------------------------------------------------------- public static void main (String args[]) { Random gen = new Random(); int[] numbers = new int[NUM]; Integer[] objects = new Integer[NUM];
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // create random numbers for (int i=0; i<NUM; i++) numbers[i] = gen.nextInt(MAX) + 1; DescendingSorts.selectionSort(numbers); System.out.println("Selection sort of " + NUM + " random numbers in descending order:"); for (int i=0; i<NUM; i++) System.out.print(numbers[i] + " "); // create new set of random numbers for (int i=0; i<NUM; i++) numbers[i] = gen.nextInt(MAX) + 1; DescendingSorts.insertionSort(numbers); System.out.println("\n\nInsertion sort of " + NUM + " random numbers in descending order:"); for (int i=0; i<NUM; i++) System.out.print(numbers[i] + " "); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online