Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I find sorting algorithms a bizarre and damaging introduction to computer science.

If, as suggested, you ask an interested teenager how they sort a list of numbers on paper, they can usually give a reasonable algorithmic explanation, e.g. "Find the smallest number in the list, and write that first,..."

Then, they have to throw that thought process away, and rote learn some different and esoteric alternative - the A-level course mentioned in this article requires you to execute bubblesort step-by-step, from memory, on paper.

When in fact, the teenager's own creative method (that we threw away) is much closer to how a computer scientist/coder should be thinking.



A well-taught computer science course will not force anyone to rote-learn algorithms. Instead it ought to walk the students through the discovery process of improving from a naive but simple bubble sort, through more complicated algorithms.

Once they understand the complexities, they can appreciate the genius of quicksort. And with the sort problem well established in their minds, they're ready to appreciate the value of more complicated data structures than the list they were working with.

The difference is between understanding how to make computers do things with the tools available (knowing about built-in sort methods) and understanding how computers actually work (learning how sort algorithms have been developed).

You may be right that a programmer doesn't need to, on a daily basis, think about how sort() is implemented. But learning to work out a well understood problem with a knowledgeable instructor will teach her how to solve the next problem she comes up against on her own that no one has yet solved.

Just like any scientific pursuit, the best way to appreciate the tools and knowledge that is currently available and what methods and processes ought to be followed to improve the tools and increase the knowledge, is to walk through the process of understanding step by step, from simple to complex. If rote is involved then someone is screwing up.


>A well-taught computer science course will not force anyone to rote-learn algorithms.

Agree but with the correction that you mean well-structured computer science course. The UK national A-level syllabus for "Decision 1", that which is under discussion, largely demands rote-learning for the examination. To avoid this, for whatever reason, would be very poor teaching.

There are structural deficiencies here, which teaching cannot overcome. (Also worth noting that this is part of the HS maths course, and mathematics teachers are typically not knowledgeable enough to offer the flavour you demand)

> Instead it ought to walk the students through the discovery process of improving from a naive but simple bubble sort, through more complicated algorithms.

Bubblesort is not naive and simple. Given the opportunity to invent a sorting algorithm from scratch, as a total beginner or as an expert, nobody would spontaneously suggest bubblesort in 2013.

Here is a more complete criticism of using bubblesort as an educational tool: http://www.cs.duke.edu/~ola/papers/bubble.pdf

If you open your course with bubblesort, it's my belief that a lot of capable students are going to be thinking "why did we start here? => computer science is not for me".

Overall, I agree with your teaching method - but bubblesort to quicksort is the wrong route. If sorting algorithms are introduced (I don't think it is a good start point), insertion/selection sort to bucket sort would be more pedagogical. The start point more closely matches students' naive understanding, and the end point forces teachers to be more clear about what the key learning points are.


Decision 1 brings back memories ... As I recall, that was the 'easy' module that everyone would do well at (precisely because it was rote-learning basic algorithms, possibly without even the use of the word 'algorithm'), to compensate for the world of pain that was Pure 3.

10 years later, however, most of it spent doing literature degrees, I remember a lot more integral calculus than box-filling.


> [...] To avoid this, for whatever reason, would be very poor teaching.

Depends. You can teach for the grades, or you can teach for lifes. In general, it's mostly university entrance requirements that care about the grades. Otherwise, don't worry about the grades at all.


But that's exactly what the author is advocating - exploring the process that the teenager came up with! There was no mention of quicksort, mergesort, bubblesort, etc - just that once you start trying to understand how to do something mechanical like sorting, you start to understand how algorithms work.


Not to mention that using N different sorting algorithms as your introduction to computer science (as is often the case) has to be the most boring, un-motivating content to choose from. The only thing worse is "lets learn about recursion using the fibonacci sequence." Ugh.


+1000.

I 'learnt about recursion' from the fibonacci sequence four of five times.

Then one day I had to make a threaded message board. And I actually learnt about recursion.


Absolutely correct. Using these abstract algorithms in such a "one-size-fits-all" pattern is very disengaging to students; Constructivist educators should work hard to find suitably contextualized algorithms to explore that individual students will find cognitively engaging.

Or at least that's the thesis of my dissertation.


In my view a reason to teach sorting is simply that it provides a set of relatively simple cases for studying things like execution speed and storage requirements.


I completely agree; in my experience sorting algorithms were a precursor to learning asymptotic notation




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: