An algorithm for introducing algorithms

This was originally posted on Grok Learning’s blog – a site worth visiting!

Some years back I blogged about teaching coding, including how I introduced programming. Some months back I wrote about computational thinking (CT) and coding and the need to distinguish the two.

This time, I’d like to dive deeper into introducing algorithms as a product of computational thinking which may not necessarily lead into coding. In particular, I want to go into concepts involved with algorithms, and not just the mechanics of CT. Click back on links above to see some of my previous algorithms for introducing algorithms. These CT models via Conrad Wolfram and Grok Learning (printable PDF) are valuable resources as well.

Algorithms Essentials

When I was planning how to introduce algorithms to my 10 Information and Software Technology class, I listed concepts relevant to algorithms as essential learning. I wanted students to engage in active learning and, by deduction, realise that these are indeed essential aspects of algorithms.

  1. Representation/notation — how to encode the algorithm
  2. Granularity — level of detail of instructions
  3. Accuracy — correctness of the algorithm, does it solve the problem correctly?
  4. Efficiency — does the algorithm save /waste time and effort
  5. Interpretation — is it ambiguous or open to interpretation?

I could add more, such as scalability, variability and bias, but decided not to, at this stage.

Intro Lesson

I started by asking the students if they knew what algorithm meant knowing most if not all would have heard the term, quite likely in maths. True enough, we came down to ‘a set of instructions designed to achieve a task or solve a problem’.

I got everyone to count off 1 to 4 and based on their number would do one of the following:

  1. Draw the steps for making toast
  2. Draw movements for a favourite dance step/sequence
  3. Write how to get from the classroom to the train station
  4. Write how to perform ‘Happy birthday’ in instrument of choice

This was a no-talking activity. If they were drawing, they couldn’t use words and if they were writing, they couldn’t use symbols or drawing.

Those doing #3 took the longest but after about 15 minutes, I got everyone to move and look at another student’s work. I also asked those who were viewing #2 to attempt to do the dance sequence.

Ensuing class discussion raised some interesting points:

  • One student quoted “using your legs, walk to the door…” which raised the issue of granularity
  • When asked whether his dance sequence was interpreted correctly, the response of “open to interpretation” raised the issue of ambiguity and ‘limitations’ of interpreters
  • “Is that even a slice of bread?” raised the representation aspect
  • Representation and accuracy were problematic for the song and the student resorted to musical notation although admittedly unsure that the notes are in fact accurate
  • Another students toast’s drawing with power setting set to maximum raised the question of efficiency — possibly saves time but risks waste

The activity allowed students to see the challenges involved when designing algorithms; and, we had the language to talk about it.

Student work samples from the intro lesson.

Follow-up Lessons

I started the next lesson by getting 2 volunteers. The first one had to add 25 and 12 (2-digit addition with no carry). The next student had to add 275 and 38 (with carry). The plan was to focus on the process of abstraction for a fairly well-known algorithm and introduce various control structures.

We talked about the term ‘abstraction’ (pick out essence, general patterns) as we discussed the algorithm for solving each of the problems above. Much merriment ensued as the students struggled to articulate the steps, especially as they could not remember the term ‘place value’ (ha!). Once we got the first sequence right, the second one presented the opportunity to introduce selection control structure, i.e. if the sum exceeded 10 and there is a carry.

From here, it was not too much of a stretch to introduce the concept of repetition control structure. So, students were then challenged to abstract further and re-write our selection-sequence algorithm to handle addition of multiple digits and numbers. Those who’ve done IST previously and familiar with pseudocode, got straight into representation without worrying about ‘How do I say this?’ that the others struggled with. And thus, I no longer had to justify why they needed to learn the key words.

“Your algorithm is different from mine.” How wonderful to hear that!

On the third lesson, the focus was on ensuring the algorithm is correct. I taught them how to desk-check, a manual process of checking algorithm logic . I premised it on this was just like their table of values when doing Algebra — and that in fact, designing algorithms is like finding the equations given a table of values. A majority of my class like maths so this was a safe bet.

We are currently on deliberate practice, necessary to develop most new skills. A quick web search generated plenty of sites giving me a range of problems varying in terms of difficulty, complexity, context/interest. Grok Learning also has heaps.

Maybe I should ask them to dance the algorithms…

The bubble-sort algorithm expressed as a folk dance.

So then…

I’m really happy with how this turned out for me. I think the students have a deeper understanding of algorithm design plus they have the vocabulary to articulate this understanding. There’s more to learn but I believe the foundation is sound.

Please share your algorithm or perhaps thoughts on how mine could improve.

Delta X

I’ve been mulling about what to do with my year 11 software (SDD) students for their 2nd project/assessment task. Apart from the syllabus outcomes, I wanted one of the outcomes to be an appreciation of how technology can be transformative and that they themselves can create such technology.

Enter CS + X, except I inverted it to X + CS. While this may be irrelevant from a maths perspective (commutative property of addition), it captures better my pitch of “what is a problem (X) that can be ameliorated with the addition of computer science (CS) ?” In other words:

X + CS = Δ X

Another outcome I wanted is to highlight the importance of understanding the problem as a premise for designing solutions….way before coding/programming comes into the picture. This gave birth to the focus question for the next project, i.e.

Is your software design worth developing?

When planning out the details of this project-based learning unit, I found the book “Setting the Standard for PBL” invaluable.  In particular, Figure 5.3 (pp  118-119) Project Design: Student Learning Guide (Sample) was incredibly helpful. In a nutshell, here were my steps:

  1. List the outcomes for assessment (based on planned Assessment Grid)
  2. Outline the syllabus content (based on planned Scope & Sequence)
  3. Define the Final Products and marking/weighting
  4. Identify instructional strategies

Here’s what I’ve got (PDF)

Here’s a student-friendly version

2016 11SDD Project2

I also created a Project Calendar which will be the basis of my students’ Gannt charts for their own projects.

From here, creating the Assessment notification was fairly straightforward with only the rubric for the Final Products left to define.

As luck would have it, I scored us free entry (thank you Google) into The Sunrise Alpha conference. It will feature successful Australian startup founders. I’m hoping this excursion on Monday will inspire my students to see that they too can be part of this.

I’m also negotiating to have mentors from UNSW School of IT. (I am very lucky!)

Finally, I got several staff members to be part of the panel to whom my students will pitch their ideas. The panel will judge whether or not the problem is worth solving and if the recommended solution is indeed viable and worth developing….fodder for next project 🙂

Of course, this is just the beginning of the story.

Tomorrow, we start in earnest. I’ve told my students about the project and we’ve already started brainstorming about ideas on problems to solve. This will have to be bedded down more when I they meet their teams…tomorrow.

What’s the fuss with coding?

The fuss about coding has grown exponentially in the past year. Having watched this space for years, I’ve certainly noticed the increased interest to expose kids to coding. Industry has been pouring resources into it, with huge initiatives and funding coming from Google, Microsoft and more besides. There is a national curriculum for it and most Australian states have adopted it….not in NSW though, the state where I teach. Media, print and online, regularly features this, too; often, about having a shortage in IT skills.  I can also see the increase in teaching coding in many schools.

Hey, one could almost think teaching and  learning to code is trendy.

But, there is always the niggling question, “Is it for everyone?”

I wonder now whether everything in various school subject curricula was subjected to such scrutiny. And if not, why not?

Is it really for everyone?

Firstly, I’d like to make a distinction between computational thinking (CT) and coding. Google’s resources on CT are quite extensive and accessible. As a problem-solving process, it is easy to see why it could be adapted across all disciplines including humanities. Some could even argue it looks like critical thinking. Can you imagine asking “should we teach critical thinking in school?”

Further, algorithms – or step by step instructions – are present in every subject. Google is right to say it is relevant across all disciplines. Quite often, however, algorithms are taught as given, e.g. using formula. And why not? It is an efficient way of disseminating human knowledge developed over time. Standing on the shoulders of giants, so to speak.

Algorithms in the CT sense is less prescriptive. Creative thinking could be incorporated as well.  Can you imagine asking “should we teach creative thinking in school?”

I heard Dr James Curran refer to CT as a process for answering “What can we automate?”  I think this really promotes a mindset leaning towards efficiency as well as innovation, a premise that things could be better and we can use digital technologies to actually make it happen….and scale it, relatively quickly and cheaply. That’s incredibly empowering!  But, it’s the sort of thing that is best experienced vs merely talked about. This echoes elements of design thinking. Can you imagine asking “should we teach design thinking in school?”

Big jump there, i.e. I joined CT with coding – using digital technologies, software programming in particular, to create solutions.;  automation via giving computers detailed instruction.

Algorithms can be viewed as just an idea. It can be represented in many ways. As a teacher, making thinking visible – i.e. ascertain students are learning – is a challenge.  In Information Software & Technologies (IST), one of the subjects I teach, algorithms can be presented as pseudocode and flowcharts.

What of coding then?

Coding can actually help refine algorithms. Sometimes this is done via affordances of programming languages such as more sophisticated built-in functions and data structures.  Often, the refinements are done as one delves deeper into solving the problem and one thinks of more possibilities or cases or scenarios.

In a nutshell, CT promotes development of algorithms and with coding, it is made visible and refined.

Is it for everyone?

I am biased and I think everyone should experience what CT and coding are like. In the same way that I think everyone should experience what creative thinking, critical thinking, design thinking – and way many more ways of thinking like systems thinking, mathematical thinking, etc (see what it’s like in schools now?).  For me, it’s beyond being trendy or shortages in skills or future job opportunities or anything like that or being great at it or even being interested in it. How do you know unless you try?

If you’re a teacher, student, parent or really anyone just wondering what the fuss is about, it’s best to experience it.  Have a go. There are lots of resources out there. One of my favourites is the NCSS Challenge – and we’re a week in.  🙂

Here are some for starters:

Feel free to add your thoughts and resources in the comments below. Thanks.