File Exchange

image thumbnail

qsort

version 1.2 (1.47 KB) by

C-style qsort routine that takes comparison function.

0 Downloads

Updated

View License

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.

Comments and Ratings (3)

Alessiox

Joke indeed.

Matthew

This file is a joke.

Rajesh

Rajesh (view profile)

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

Updates

1.2

Toolbox

1.1

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

MATLAB Release
MATLAB 7.9 (R2009b)

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

» Watch video