# More Sorting Algorithms!

An update to Simon’s new project: a series of video tutorials on sorting algorithms! See the full playlist here.

Finally, parts 6 and 7 of Simon’s exciting series of video tutorials about sorting algorithms are done! In the videos, Simon codes on his RaspberryPi, but here is the link to the Python code (parts 6 – 7) available on his GitHub page:
https://gist.github.com/simon-tiger/be3864b36f6d89fecd06f150063a6321

The code of the sorting algorithms discussed in the previous videos (parts 1 – 5) is available here: https://gist.github.com/simon-tiger/5be70247a066f69c2578be5bb8e41e59

Simon wrote the Shellsort code himself. He tried to run his own code for Heapsort as well, but didn’t get the list fully sorted, so in the end he implemented the heapsort code that he learned from Brilliant.

“Then, with VERY much relief, I MASSIVELY condensed the code (to just 3 lines!), using Zax Rosenberg’s blog“, Simon adds.

# Simon creates a playlist with Sorting Algorithms tutorials in Python

Simon has started a huge new project: a series of video tutorials about sorting algorithms. In the videos, he codes on his RaspberryPi, but here is the link to the Python code available on his GitHub page (that he continuously updates): https://gist.github.com/simon-tiger/5be70247a066f69c2578be5bb8e41e59

Today, Simon has recorded the fifth part of the series, in which he explains and applies the Quicksort algorithm. [The coding part goes very smoothly and much quicker (hehe) than in the previous sorting videos we have made so far. Simon also came up with his own code, he didn’t look the code up].

And here come the previous parts of Simon’s sorting algorithms series, also available via this link to a playlist on his YouTube channel (there will be more videos coming):

Simon is also fascinated by more exotic sorting algorithms, such as a sorting network:

Simon used the following resources: Daniel Shiffman’s tutorial on Quicksort, Timo Bingmann’s sort algorithms visualization, Must Know Sorting Algorithms in Python, a medium blog on sorting algorithms, Brilliant.org’s computer science courses, Wikipedia.

# Processing on RaspberryPi

Simon installed Processing on his RaspberryPi recently (using the terminal, which looked terribly sophisticated and scary as on Linux you’re forced to do everything through the terminal) and started preparing examples that he hoped to show during his own livestreams, but the RaspberryPi seems to have crashed, unable to bear the weight of so many examples…

# Cellular Automata in Arduino

Yesterday Simon spent the whole day studying the concept of Cellular Automaton (CA), a discrete model of a system of “cell” objects used in physics, math and theoretical biology. He learned a lot from Daniel Shiffman’s tutorials on Cellular Automata and his book The Nature of Code (Chapter 7).

Simon describes Cellular Automaton as a set of rules for getting nature-like patterns. 1D cellular automata are static (think of a pattern resembling the Pascal triangle) and 2D are not static (the most famous example is Conway’s Game of Life).

The mathematician who made cellular automata a big thing (and even Turing-compatible!) was Stephen Wolfram. Simon also looked at some of Wolfram’s writings. Wolfram’s book A New Kind of Science is intimidating (in content and size) but full of graphic illustrations and available for free at http://www.wolframscience.com/nksonline/toc.html

A CA is basically a grid where cells live, each cell in a particular state (the simplest example being “1” or “0”). In Processing, it’s possible to have a CA draw a beautiful pattern this way. Simon tried to write a CA program in another language. He tried writing it in Python on his RaspberryPi first, but I overheard him say “don’t know how classes really work in Python, let’s try Ruby – I know how classes work in Ruby!” Then I saw him move over to the desktop and plug his long forgotten Arduino in. He said he now wanted to translate a CA code into C. Of course, there would be no pattern, but he wanted to have the Arduino “spit out numbers in the console” instead. Eventually he got an error and gave up, but it was intriguing to observe him.

The videos below show Simon talk about CA and program a CA in Arduino (C):

# Wolfram in RaspberryPi

Simon tried out a new language Wolfram on his RaspberryPi. Wolfram is a programming language that can be used to program 3D print sketches. “With different functions and constants you can do it exactly the way you want”, Simon says. In the video below he used Wolfram in a simple terminal.

Simon later also used Wolfram in Mathematica, a text editor pre-installed on RaspberryPi.

Wolfram can be used to program objects for 3D printing.

# Making a webpage

This was one of the LearnWebCode challenges Simon did this week. It involved using Handlebars (a tool for JavaScript) to create a webpage about pets. Simon programmed the webpage on his RaspberryPi. The first day he got stuck and gave up. On the second day we took a look at it together and found the bug: he had forgotten quotation marks in one place. We were like two happy puppies when we discovered the mistake.

# What is Simon’s level in coding and problem solving?

Simon carried out a project on his new RaspberryPi today that allows to see his programming and problem solving level quite well. Luckily I was there on time with my iPhone camera to film and take pictures.

It involved a simple Blink-an-LED code for Python, but note that Simon wrote it completely from memory. Also interesting that since he was missing the M/F jumper wires required for the project he decided to use his broken M/M wires instead, which I thought was quite inventive.

He used Terminal to create a program called led.py, saved and closed the file and opened the File Manager. He looked for the led.py file, but it wasn’t there.  So he hit Shift-Ctrl-F to search for it and found it. He opened the file by right-clicking on it and selected Python 2 (IDLE). He made sure the correct screen appeared and that the Python code was complete. He then ran the code by typing “sudo python led.py” . Unfortunately a syntax error message popped up.

After a moment of hesitation (when I though he maybe would give up) he said he knew what the error was: he missed a couple of comas. After inserting the comas in the Leafpad file he ran the code again. And it worked!! We were both so happy as if we witnessed sheer magic.

Later Simon also showed me how to make the LED light burn continuously or turn it off again.

The missing comas back in place:

# RaspberryPi work station

When Simon got a new RaspberryPi 3 from Sinterklaas on Sunday joy quickly turned into drama as he discovered the old (and only) keyboard we had at home was outdated and had no usb connection. His original plan was to use the television screen as the RaspberryPi screen and that would have let towards constant struggle with those other members of the family who actually wanted to watch tv. What made things worse was that it was Sunday and all Belgian computer stores (and all other Belgian stores) were closed. Simon was devastated as he’d really set his mind on this project. We jumped in the car and drove to The Netherlands where people never stop working and neither does MediaMarkt. Within an hour we got a wireless keyboard and a nice Samsung screen, both at a good price, and went for a drink on the Grote Markt square of the old Dutch town Bergen op Zoom. And now we’ve got one more “desktop”.

Simon has been using this single board computer to train html and JavaScript. His favourite is setting the background colour in hexadecimals.