//ESC101 : Fundamental of Computing //Lab 9 for 23 October 2008 /*Create an array A of length n which will store integers, the value of n is to be provided from command line. Fill the array with random integers from range 0 to 14. Print the array A. Remove all the duplicate elements within the array and print the array (without duplicates) again. How can you use sorting to solve this problem ?*/ /*key idea: Generate random numbers. Sort them using any sorting algorithm. once sorted we can parse the sorted array starting from the first position, keeping track of number of duplicates we have, whenever we encounter a value different value we shift the whole array*/ import java.util.*; class Remduplicate{ public static void main(String args[]){ int num = Integer.parseInt(args[0]); int array[] = new int[num]; /* code for generating random numbers*/ Random r =new Random(); for(int i=0;i array[j+1]){ int temp = array[j]; array[j] = array[j+1]; array[j+1] = temp; } } } System.out.println("the numbers after sorting"); for(int i=0;i