Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quicksort #76

Closed
broadsw0rd opened this issue Dec 13, 2017 · 1 comment
Closed

Quicksort #76

broadsw0rd opened this issue Dec 13, 2017 · 1 comment

Comments

@broadsw0rd
Copy link

const qs = (
  [p, ...xs],
  lesser = xs.filter(_ => _ <= p),
  greater = xs.filter(_ => _ > p)
) => p ? [...qs(lesser), p, ...qs(greater)] : []

// qsort([20, 11, 2, 7, 89, -9, 34, 14, 0, 20]) -> [-9, 2, 7, 11, 14, 20, 20, 34, 89]
@lock
Copy link

lock bot commented Dec 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for any follow-up tasks.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant