Bucket Sort Implementation In Java

Bucket Sort Implementation In Java
Sorting Techniques

import java.io.*;
class node1
      {
        int data;
        node1 next;
     node1(int n)
       {
     data=n;
    next=null;
       }
 
}
class list
   {
node1 last[]=new node1[10];
node1 bucket[]=new node1[10];
node1 current;
int i;
list()
{}
void bucket_sort(int x[],int n)
{
  for( i=0;i<10;i++)
  last[i]=bucket[i]=null;
  for(i=0;i<n;i++)
    {
   node1 temp=new node1(x[i]);
if(bucket[x[i]]==null)
bucket[x[i]]=last[x[i]]=temp;
else
    {
     last[x[i]].next=temp;
    last[x[i]]=temp;
   }
}
int j=0;
for(i=0;i<10;i++)
    {
current=bucket[i];
while(current!=null)
    {
x[j]=current.data;
    j++;
current=current.next;
}
}
}
}
 
class bucket1
{
 public static int c=0;
 public static void main(String args[]) throws IOException
  {
  int a[],n;
   BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); 
   list l=new list();
System.out.println(“Enter size of array = “);
   n = Integer.parseInt(b.readLine());
   a = new int[n];
   System.out.println(“Enter values = “);
   for(int i=0;i<n;i++)
     a[i] = Integer.parseInt(b.readLine());
   l.bucket_sort(a,n);
   System.out.println(” Sorted Array is : “);
   for(int i=0;i<n;i++)
   {
    System.out.println(a[i]+” “);
   }
  }
}