Sequential Sort in Java

Java Code for Sequential Sort Algorithm

The below example program is used to sort an array using Sequential Sort Algorithm.
//source code SequentialSort.java

import java.util.Scanner;
import static java.lang.System.*;
class SequentialSort
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter Size of the Array");
int x[]=new int[sc.nextInt()];
System.out.println("Enter elements");
for(int i=0;i<x.length;i++)
x[i]=sc.nextInt();
System.out.println("\n Original Array");
for(int i:x)
out.print(i+", ");
for(int i=0;i<x.length;i++)
{
for(int j=0;j<x.length;j++)
{
if(x[i]<x[j])
{
int t;
t=x[i];
x[i]=x[j];
x[j]=t;
}

}
}
System.out.println("\n Array element after sorting array using Sequential Sort");
for(int i:x)
out.print(i+", ");
}
}

The above program is an example for Sorting an array using Sequential Sorting algorithm.


Related Topic Array Search in Java
PHP Programming Best Practices
Merge Sort Java Program Source Code
Android: Bluetooth Application Manager Interaction
What are All the Features Available in Android to Develop Application
Java  

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback