Created
May 30, 2020 06:29
-
-
Save Irene-123/8185992745531466973c3f40ed020872 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
```python3 | |
# https://www.hackerrank.com/challenges/quicksort1/problem | |
def quickSort(arr): | |
p=arr[0] | |
left=[] | |
right=[] | |
equal=[] | |
for i in range(1,n): | |
if arr[i]>p: | |
right.append(arr[i]) | |
elif arr[i]<p: | |
left.append(arr[i]) | |
elif arr[i]==p: | |
equal.append(arr[i]) | |
else: | |
equal.append(arr[i]) | |
left.append(p) | |
soln=left+equal+right | |
return soln | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment