Skip to content

Commit

Permalink
[Quicksort]Added shuffling of input
Browse files Browse the repository at this point in the history
  • Loading branch information
miczal committed Aug 11, 2016
1 parent e514065 commit 78402c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sorts/quick_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
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):
Expand Down Expand Up @@ -58,4 +64,4 @@ def quick_sort(collection):

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))

0 comments on commit 78402c5

Please sign in to comment.