Skip to content

Commit 668c21f

Browse files
authored
Merge pull request #144 from raj-rathod/rajesh
fix:<Quick Sort> #142 Quick sort working procedure
2 parents f3dd7e1 + e97ab6a commit 668c21f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/app/core/algorithms/sorting-meta-data.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,17 @@ const quickSortData = {
248248
flowChart:"assets/ds-image/comming-soon.jpg",
249249
explainImage:"assets/ds-image/comming-soon.jpg",
250250
workingProcedure:[
251+
'quickSort(arr, left, right)',
252+
'if right > left',
253+
'pivotIndex = partition(arr, left, right)<br> quickSort(arr, left, pivotIndex-1)<br> quickSort(arr, pivotIndex+1, right)',
254+
'<b>Below Partition Flow</b>',
251255
'Consider the first element of the list as pivot (i.e., Element at first position in the list)',
252256
'Define two variables i and j. Set i and j to first and last elements of the list respectively',
253-
'Increment i until list[i] > pivot then stop',
254-
'Decrement j until list[j] < pivot then stop',
257+
'Increment i until list[i] < pivot then stop',
258+
'Decrement j until list[j] > pivot then stop',
255259
'If i < j then exchange list[i] and list[j]',
256260
'Repeat steps 3,4 & 5 until i > j',
257-
'Exchange the pivot element with list[j] element'
261+
'Exchange the pivot element with list[j] element and return j'
258262
],
259263
properties:[
260264
'Quick Sort is useful for sorting arrays',

0 commit comments

Comments
 (0)