A Generic Quicksort Implementation in C

As assignment for Data Structures and Algorithms course, we had to work with a modified version of the quicksort algorithm. It came obvious that for modifying a qsort you need to implement it

It is difficult to find a clear quicksort algorithm implemented, so I wrote it.

Here is the generic C implementation of the Quicksort Algorithm, which sorts an array in place, following the Divide And Conquer design.

As you see, there is nothing optimized in this implementation. It just looks elegant and easy to be understood.
If you would like to have a more optimized version of this algorithm, take a look at this one.

Published by


Daniel Graziotin is a doctoral researcher in computer science, software engineering at the Free University of Bozen-Bolzano, Italy. His research interests include human aspects in empirical software engineering with psychological measurements, Web engineering, and open science. He researches, publishes, and reviews for venues in software engineering, human-computer interaction, and psychology. Daniel is the founder of the psychoempirical software engineering discipline and guidelines. He is academic editor at the Research Ideas and Outcomes (RIO) journal and at the Open Communications in Computer Science journal. He is editorial associate at the Journal of Open Research Software and the local coordinator of the Italian Open science local group for the Open Knowledge Foundation. He is a member of the ACM, SIGSOFT, IEEE, and the IEEE Computer Society.

Leave a Reply

Your email address will not be published. Required fields are marked *