View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
qsort

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

2.0
2.0 | 3 ratings Rate this file 0 Downloads (last 30 days) File Size: 1.47 KB File ID: #26612 Version: 1.2

qsort

by

Malcolm McLean (view profile)

 

07 Feb 2010 (Updated )

C-style qsort routine that takes comparison function.

| Watch this File

File Information
Description

Simple implementation of quicksort algorithm in Matlab. It's O(N log N) but the only optimisation is that the pivot point is the central element (to prevent pathological behaviour on sorted input). It takes a C-style comparison function. If the vector to sort is a cell array, the comparison function works on cell contents. Any type of data can be sorted, as long as you can write a comparator for it.

Required Products MATLAB
MATLAB release MATLAB 7.9 (R2009b)
MATLAB Search Path
/
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
14 Apr 2016 Alessiox

Joke indeed.

03 Feb 2011 Matthew

This file is a joke.

17 Aug 2010 Rajesh

Rajesh (view profile)

Thanks MM, Nice and handy applications. It did for me something that sortrows and sort could not do.

Updates
19 Aug 2010 1.1

Patch to reduce the number of recursions when fed data of all equal value.

29 Nov 2014 1.2

Toolbox

Contact us