DEV Community

Juan Julián Merelo Guervós
Juan Julián Merelo Guervós

Posted on

Sorting people for fun and teaching computer science

During the science week in early November, students arrive to the university of Granada to listen to us profs talk about what we do. Frankly, I myself find what I do the most boring stuff in the world. So this time I went out to talk less and do more, and make people think about what they can do, instead. This is what we did.
Here is Paula and you should so follow her. When everyone was sitting down with their coffee and pastries, she told them what she, a hacker, does, how she loves sharing information and how they can do that too. That helped them see what they can do from someone that was, just a few years ago, just like them and shot a few stereotypes. Same thing coming from a prof would not have worked.

All the pictures below were taken by her.

Then we tried to shoot down the stereotype that algorithms are complicated stuff and that computing is done by computers by physically doing some sorting algorithms. First one, a zero knowledge game where we computed the average weight of a the two groups we divided the class in without finding out or revealing a single individual weight. Instead of using papers, we used their own phones and the calculator inside it to sum over the secret initial quantity, for which you should use easy numbers, over all if you are going to use several groups, and find out the average. The trick here is to make everyone add their weight to the number that is passed to them; finally the initial number will be substracted and we will divide by the number of people to find the average. It is an easy algorithm, it is something that they can do themselves, and it worked; they kept attention and understood it quite well. They were not awed, but at least they were amused.

Then we went to sorting, inspired also by the CS Unplugged site. It helps that computers in Spanish are called ordenadores which means sorters. So after just a few sentences, we started with sorting by height. I chose someone to act as "computer", and on purpose I chose girls to once again break stereotypes. It was a subtle thing, but probably worked. What the sorter has to do in this case is just rank by height. They stand up, they go to the middle of the room, and they were sorted quite fast. It helped that we were in the middle of a cafeteria and that the format was a "cafe", but you can do it pretty much anywhere. The thing is this sorting algorithm is suited for humans: you can see globally and you can visually sort them before asking them to move to the right slot.
Globally sorting
That was mainly used to gauge how much time it was going to take and to tell them that computers are going to do it in a different way. Then, they wrote their birth date in a Post It and stuck it in a visible area. They did it with a pencil, so that it was not really visible unless you got close to them; and then you could only see two of them at the same time. Same way the computers do: they can only compare two by two. We divided them by groups, one of us explained to them Bubble Sort, and the other Quicksort. Girls were again selected to be the sorters, one in every group. They then proceeded to sort their group. Quicksort finished in no time, they were around 10. Bubble sort still took a while. Segue to short explanation of algorithm efficiency and why it works that way. And then Merge Sort: without moving, choose another person to sort using that algorithm: compare the first ones in the row, take the younger every time.

Merge sort

Took them almost less. One minute or less to explain why it was so fast, why algorithms were cool, and then Paula had to answer their questions.

Take home message

They probably took home the message we wanted to transmit: computer science can be different and fun, and anyone can do it.

I took note of how much it took to do every single thing, and forgot to make a timelapse movie of their sorting antics, which I will totally remember next time. And of course thanked Paula, who would have done it perfectly without me. And who actually took the pictures that allowed me to illustrate this post.

Top comments (2)

terceranexus6 profile image

It was a lot of fun! I really enjoyed explaining the students the Bubble algorithm, and I was asked a lot of things about security and the maths role in computer science.

I wish more of these approaching were done at the university. Many high school students doesn't even know there's such a grade as "Computer Engineering" :/

Also, welcome to, JJ!

jj profile image
Juan Julián Merelo Guervós

It was obvious they related to you more than they did to me. I think next year science week should be performed by students like you. I'll happily help you and hand Ikea pencils as gifts to whoever you tell me.