BrainFuck part 9 - Sort arrays with Bubble and QuickSort

DPAmar
7,260 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

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
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content