mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-18 16:27:02 +00:00
[Quicksort]Added shuffling of input
This commit is contained in:
parent
e51406583c
commit
78402c5f42
|
@ -10,6 +10,12 @@ For manual testing run:
|
|||
python quick_sort.py
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from random import shuffle
|
||||
|
||||
|
||||
def sort(collection):
|
||||
shuffle(collection)
|
||||
return quick_sort(collection)
|
||||
|
||||
|
||||
def quick_sort(collection):
|
||||
|
@ -58,4 +64,4 @@ if __name__ == '__main__':
|
|||
|
||||
user_input = input_function('Enter numbers separated by coma:\n')
|
||||
unsorted = [int(item) for item in user_input.split(',')]
|
||||
print(quick_sort(unsorted))
|
||||
print(sort(unsorted))
|
||||
|
|
Loading…
Reference in New Issue
Block a user