Sorting in Java

Sorting is the process through which elements can be arranged in ascending or descending order. Sorting can be done on numbers, strings etc.

In Java inbuilt functions are also available to directly sort the series. These inbuilt functions are provided by Collections framework in Java.

Example :-

Unsorted series = 24, 20, 100, 203, 1, 80

Sorted in Ascending order = 1, 20, 24, 80, 100 ,203

There are many algorithms to perform sorting. Few of them are :-

  1. Bubble Sort
  2. Selection Sort
  3. Insertion Sort
  4. Quick sort
  5. Merge sort

Let us start with most basic sorting – Bubble sorting.

Leave a Comment