Using quicksort in real life

Whenever I need to sort a list of items, I now find myself using quicksort. I most frequently use it when prioritising my goals. Quicksort provides a fast and methodical way to sort lists of things, and it’s normally used internally by computers, but that doesn’t stop you from using it yourself, manually. In case you haven’t encountered the algorithm before, I’ll walk through how to use it. All of this can be done in your favourite text editor or note taking tool.

0) Start with a list of items you want to sort. In this example, I’ll use a few of my goals for this week:

The SLCD site has easy-to-use instructions for adding content
I have a time booked for my first toastmasters speech
I’m getting the hang of cooking the curried udon noodle stir-fry
My LinkedIn resume is freshly updated with my recent changes
Some fresh updates for TTD are online

1) Select and highlight an element that you think should be approximately in the middle in the list. This is called the “pivot” element.

The SLCD site has easy-to-use instructions for adding content
I have a time booked for my first toastmasters speech
I’m getting the hang of cooking the curried udon noodle stir-fry
—– My LinkedIn resume is freshly updated with my recent changes
Some fresh updates for TTD are online

2) Compare every item on the list to the pivot element, and move them either above or below it.

The SLCD site has easy-to-use instructions for adding content
I have a time booked for my first toastmasters speech
Some fresh updates for TTD are online
—– My LinkedIn resume is freshly updated with my recent changes
I’m getting the hang of cooking the curried udon noodle stir-fry

3) Repeat the process from step 1 for the items above, and then the items below the pivot.

The SLCD site has easy-to-use instructions for adding content
Some fresh updates for TTD are online
— I have a time booked for my first toastmasters speech
—– My LinkedIn resume is freshly updated with my recent changes
I’m getting the hang of cooking the curried udon noodle stir-fry

4) When sorting larger lists, you’ll need to keep going, subdividing the list above and below the pivot, until all the items are sorted.

Try it out! It’s quick and easy once you’ve got the hang of it, and you’ll gain nerd bragging rights (if you choose to publicise your achievement)!

Share and Enjoy:
  • Facebook
  • StumbleUpon
  • Twitter

Random readings...


     
     
     

    Leave a Reply

    CommentLuv Enabled