Back
Close

BrainFuck part 9 - Sort arrays with Bubble and QuickSort

DPAmar
6,808 views

Welcome!

Welcome to this new playground about the BF language. Make sure you already read

playgrounds if you didn't already !

The goal of this playground is to implement different sort algorithms on arrays.

Sorting is a very popular problem in computer science : how to find the best sorting algorithm for a given case?

In order to compare these codes efficiently, let's have a common template to compare executions. In this playground, we will use arrays of non-null values, to focus on sorts and not on "possibly-null 2-cell-long arrays"

Char template

>>>>>>               leave as many cells as needed (for sorting algorithm)
,[>,]                read a list of chars
        __ do the sort __
[.>]                 print sorted list of chars

Playground contents

We will implement 2 different sorting codes:

  • Bubble sort, said as one of the easiest to understand
  • Quicksort, one the of most powerful ones
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io