quicksort

Quicksort implementation in Matlab, works in O(n)=n*log(n)
697 Downloads
Updated 21 Dec 2020

View License

Sort a row vector in ascending order using a variant of Quicksort. Original work: C. A. R. Hoare: Quicksort. In: The Computer Journal. 5(1), 1962, p. 10–15. This implementation works in place and runs in O(n)=n*log(n). There are no practical advantages over the build-in sort function. The purpose of this implementation is to show that quicksort can be implemented in Matlab with O(n)=n*log(n) runtime (average case).

Cite As

Christian Werner (2025). quicksort (https://www.mathworks.com/matlabcentral/fileexchange/66704-quicksort), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Financial Toolbox in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.2.0.2

Removed input argument check within recursion (Shlomo Geva, thank you for commenting!)

1.2.0.1

Removed input argument check within recursion (Shlomo Geva, thank you for commenting!)

1.2.0.0

Improved documentation.

1.1.0.0

Improved error checking, improved documentation.

1.0.0.0