Skip to content

Quick sort - #25

Open
steventhan wants to merge 7 commits into
masterfrom
quick_sort
Open

Quick sort#25
steventhan wants to merge 7 commits into
masterfrom
quick_sort

Conversation

@steventhan

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread src/quick_sort.py Outdated
midpoint = a_list[len(a_list)//2]
pivot = sorted([low, hi, midpoint])[1]
for item in a_list:
if item < pivot:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work in a lot of cases, but there is another scenario which you are not considering, and for which you need to test. Currently your algorithm is getting stuck in an infinite loop.

Make sure you include some test cases with duplicate items in your list to be sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants