In this recipe, we will write a pseudo-quick sort using recursion. We call it pseudo-quick sort because it looks deceptively such as quick sort, but does not have a performance anywhere near it.
Sorting a list
Getting ready
Use Stack to create a new project, pseudo-qsort, with the simple template and build it, after changing directory to the project folder:
> stack new pseudo-qsort simple
> stack build
How to do it...
- Open src/Main.hs and write the qsort implementation. The qsort involves the following:
- Choosing an element of the list to be sorted
- Using...