import java.io.*;
class naks
{
public static void main(String args[]) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int num;
System.out.print("Enter the number of elements to be entered:"+"\t");
num=Integer.parseInt(br.readLine());
int arr[]=new int[num];
for(int i=0;i< num;i++)
{
System.out.print("index["+i+"]:"+"\t");
arr[i]=Integer.parseInt(br.readLine());
}
System.out.print("Entered numbers:"+" ");
{
for(int i=0;i<num;i++)
System.out.print(arr[i]);
}
{System.out.println("\n"+"bubbleSort"+" ");
}
for(int i=0;i< num;i++)
{
for(int j=i+1;j< num;j++)
{
if(arr[i]>arr[j])
{
int temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
for(int k=0;k<num;k++){
System.out.print(arr[k]+"\t");
System.out.print("\t");
}
}
}
}
}
}
this my question can u help me how to insert my selection sort in this program/....

New Topic/Question
Reply




MultiQuote







|