public static void main(String[] args) { List namesList = new ArrayList(); String name = ""; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); for (int i=0; i<3 ; i++){ System.out.print("Enter the Name : "); try { name = br.readLine(); } catch (Exception e){ System.out.println(e.getMessage()); } namesList.add(name); } Collections.sort(namesList, new Comparator() { public int compare(Object o1, Object o2) { String name1 = (String) o1; String name2 = (String) o2; return name1.compareToIgnoreCase(name2); } }); System.out.println("namesList.toString() = " + namesList.toString()); } //alphapetical sort ***************Algorithm Bucketsort(a,n) Here a is a linear array of integers with n elements, the variable digitcount is used to store the number of digits in the largest number in order to control the number of passes to be performed. Begin find the largest number of the array set digitcount=no. of digits of the largest no. for pass=1 to digitcount by 1 do initialize buckets for i=1 to n-1 by 1 do set digit=obtain digit no. pass of a[i] put a[i] in bucket no. digit increment bucket count for bucket no. digit endfor collect all the numbers from buckets in order endfor end *****************************************************************************