#### Bubble Sorting with Array

*Sorting is maximum using for data order and disorder in programming language.*

*This topic is help in creating report like monthly, daily, yearly etc. Using we can easily find and search data from list.*

*In this blog, we will work on bubble sort process with examples.*

#### Bubble Sorting In 1-d Array

import java.io.*;

class arr5

{

public static void main(String args[]) throws IOException

{

InputStreamReader in1 = new InputStreamReader(System.in);

BufferedReader br = new BufferedReader(in1);

int[] x = new int[5];

int temp;

System.out.println(“Enter Array : “);

for(int i=0;i<=4;i++)

{

x[i] = Integer.parseInt(br.readLine());

}

for(int i=0;i<x.length;i++)

{

for(int j=i+1;j<x.length;j++)

{

if(x[i] > x[j])

{

temp = x[i];

x[i] = x[j];

x[j] = temp;

}

}

}

System.out.println(“Sorted List:”);

for(int i=0;i<=4;i++)

{

System.out.println(x[i]);

}

}

}

#### Output:

Enter Array:

23

12

-45

65

6

Sorted List:

-45

6

12

23

65

#### Basic to Advance Level Tutorial.

No | Title |

1 | Work on selection Sorting |

2 | Work on Merge Sorting |

3 | Work on insertion search |

4 | Work on binary search. |

### Share and Enjoy

265total visits,1visits today