Quick Sort Algorithm Explained and Implemented with Examples in Java | Sorting Algorithms | Geekific

preview_player
Показать описание

In the past few weeks, we’ve been adding a ton of videos to the sorting algorithms series. However, these videos were still missing one of the most important and efficient sorting algorithms. Today we intend we fix this, because in this video we detail and implement the quick sort algorithm.

Timestamps:
00:00 Introduction
01:25 Sorting an array using Quick Sort!
05:09 Quick Sort Implementation
09:25 Putting our Code to the Test
10:14 Thanks for Watching!

If you found this video helpful, check other Geekific uploads:

#Geekific #SortingAlgorithms #QuickSort #Java
Рекомендации по теме
Комментарии
Автор

I think we have a simpler way for partition of an array: arr[]
1. Choose a pivot: p
2. Use two cursors L (left) that is the first index of array and R (right) is the last index.
3. Rule: while L <= R:
3.1. Increase L while arr[L] < p (loop until we find an element that is not less than pivot)
3.2. Decrease R while arr[R] >= p (loop until we find an element that is less than pivot)
3.3. If L < R: swap(arr[L], arr[R])
4. Return L (partition point)
Then we call quickSort(arr, begin, mid - 1) and quickSort(arr, mid, end). With "begin" is the first index of array, "end" is the last index, "mid" = partition point.

trannhanITSinhVien
Автор

Thanks for this video. The explanations for the partition call stack was really helpful in understanding the algorithm better.

santhoshkumar
Автор

Fantastic explanation. To improvise the performance we can avoid the swapping for the pivotIndexCounter == i.
At 6:42 inside the if condition you can add the below code to do that.
if(pivotIndexCounter==i) {
pivotIndexCounter++;
continue;
}

FluteVJ
Автор

I think this is isn't fully correct. You need to have a pivot and a "i" and "j" and you compare those with the pivot.

MineCrafterCity
welcome to shbcf.ru