-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09be041
commit 0b27ef4
Showing
5 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// To be added |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
![cover](./cover.png) | ||
|
||
# Day 35 - Search and Sort Algorithms Part H: Quick Sort | ||
|
||
Like Merge Sort, QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot. | ||
|
||
## Pseudocode | ||
|
||
``` | ||
/* low --> Starting index, high --> Ending index */ | ||
quickSort(arr[], low, high) | ||
{ | ||
if (low < high) | ||
{ | ||
/* pi is partitioning index, arr[pi] is now | ||
at right place */ | ||
pi = partition(arr, low, high); | ||
quickSort(arr, low, pi - 1); // Before pi | ||
quickSort(arr, pi + 1, high); // After pi | ||
} | ||
} | ||
``` | ||
|
||
Referance: https://www.geeksforgeeks.org/quick-sort/ | ||
|
||
## Question | ||
|
||
**Type:** Divide and Conquer | ||
|
||
Given an unsorted list of elements, write a program to sort the given list using quick sort. | ||
|
||
**Example** | ||
|
||
``` | ||
input: [1, 5, 2, 7, 3, 4, 8, 9, 6] | ||
output: [1, 2, 3, 4, 5, 6, 7, 8, 9] | ||
``` | ||
|
||
## Solution | ||
|
||
### [JavaScript Implementation](./JavaScript/mergeSort.js) | ||
|
||
```js | ||
to be added | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.