Code covered by the BSD License  

Highlights from
qsort

2.5

2.5 | 2 ratings Rate this file 16 Downloads (last 30 days) File Size: 1.47 KB File ID: #26612

qsort

by

 

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.

MATLAB release MATLAB 7.9 (R2009b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
03 Feb 2011 Matthew

This file is a joke.

17 Aug 2010 Rajesh

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

Updates
19 Aug 2010

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

Contact us