Last Updated: 06 October, 2024 5 Mins
Sorting is the process of arranging a list of unsorted data in a particular order, either ascending or descending. Sort algorithms play a very crucial role for organizing unsorted data and facilitating efficient searching, retrieval, and analysis.
Every sorting algorithm has a unique approach for sorting the data; these sorting algorithms are used according to the specific requirements of the problem, including data size, structure, and distribution, as well as time and space constraints.
In this tutorial, we are going to learn all about Quick Sort in Java.
Quick sort is an efficient and fast sorting algorithm used to sort a sorted list of elements.
Quick sort uses a divide and conquer strategy that means it attempts to separate the list of elements into two parts and then sort each part recursively. In quick sort, the partition of the list is performed based on the element called pivot. Here the pivot element is one of the elements in the list.
The list is divided into two partitions such that "all elements to the left of pivot are smaller than the pivot and all elements to the right of pivot are greater than or equal to the pivot.".
The quick sort algorithm was invented by C. A. R. Hoare.
Output
Sorted Array:
10 20 30 40 50 60 70 80 90 100
That's all, guys. I hope this article is helpful for you.
Happy Learning... 😀
feedback@javabytechie.com