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.

I do and I understand

Confucius says (oh my, I’ve been wanting to do that for ages…haha):

I hear and I forget. I see and I remember. I do and I understand.

In my random clicking on the internet disguised as professional development (or maybe it’s the reverse), I found a couple of strategies interesting enough to try.

Fishbowl

The first came from an Edutopia video, How to teach maths as a social activity. I’m a big fan of cooperative and collaborative learning and this video has good strategies. What I wanted to try immediately was called Fishbowl (video link). Basically, it’s having a small group sit and discuss while the rest of the class observe. I’ve heard of it before but this is the first time I intended to give it a go.

With my year 10s going into their exam block next week, and coming in from a 2-week school holidays, I thought that Fishbowl would be an interesting way to do some revision. So I set up 3 groups to discuss (1) Bias in algorithm, (2) Use of cookies, and (3) Robotics in employment.

These topics are directly related to the topics we did this year (1) Software Design and Programming, (2) Internet, and (3) Robotics.

I gave them 5-10 minutes to do a quick revision using our class notes or to look up on the web. This had to be done individually, i.e. no discussions. Then, the group took turns to be in the Fishbowl.

While I set this out as a revision exercise, what I found was Fishbowl is also an effective assessment activity. I doubt I’ll use it for summative assessments but as formative assessment, it was really good to see what the small group, and whole class, knew…or did not know…or got confused on. It also contextualised my assessment tips such as – give specific details, use technical terms and make sure you know their definitions, think of positives and negatives when discussing issues, you can link topics we studied,  use Asimov’s Laws on Robotics when discussing issues, and the like.

Tic Tac Toe + Jeopardy

Our current unit of work in 9IST is game design, a culmination of the Digital Media and Software Design and Programming topics we studied this year. They also have a yearly exam coming soon and I thought what better way to do revision than to play games. We will unpack the following experience next lesson and use that to feed into the work they yet have to do.

I found my inspiration in a recently discovered (read: yesterday) differentiation site, daretodifferentiate (link to Choice boards or tic tac toe, though the wiki site warrant more exploration). I wanted to try it straight away but all mu units are already designed so I figured I might as well use it for revision….and as a game!

The plan was to have a choice board with easy, medium and hard questions – that’s the tic tac toe part. Assigning points to the questions was the Jeopardy part.

I’m not going to include all the questions here but here’s a small sample so you get the idea: easy – JPEG is a lossy format (True or False?), medium – Define algorithm, hard – Explain one way that text can be digitised. For points, I gave 100 for easy, 150 for medium and 200 for hard.

Using the simple definition of games = goal + rules, I discussed the rules of tic tac toe and Jeopardy. They work in groups, nominate a speaker (and there can be no repeat speakers) to provide the answer. I also added a rule of ‘stealing’, i.e. if a group can answer a question better then they “steal (the chance to earn)” the points. This was actually good to ensure they all tried their best and that they listened to other groups. Revision and learning were happening at individual, small group and whole class level. Granted, still at different levels but even the quietest student could learn from others at least. I dropped the ‘tic tac toe’ all in a line across three columns because I had 3 groups…but that would be fun to design to get some blocking strategy happening as well.

Speaking of designing the thing, I wanted to implement this in Scratch, or with more time and effort – JavaScript or Python perhaps. But, given that I thought of this on the eve of using it, I resorted to a table in PowerPoint and using animated blocks to hide/reveal the questions. It’s been a while since I used the ‘click on object’ as trigger (default is just click anywhere) that I’ve forgotten about it. On the whole, it worked quite well actually….yep, a PowerPoint hack 🙂

Even with a short activity, I can see the power of differentiation through choice….and of course, I’m convinced about cooperative and collaborative learning anyway.

9IST groups in a huddle, discussing strategies and answers

9IST groups in a huddle, discussing strategies and answers

Back to Confucius

There are so many teaching and learning resources out there and seriously, there are many good ones. Finding ones to try and then actually making it happen help cement them in my mind because I don’t only know of, I also understand.

Also, because I mostly teach via Project-Based Learning, my students have done the ‘do’ bit and yet, as I’ve uncovered in these revision activities today, they don’t always remember or understand. And so then, back to Confucius:

By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest.

Revision (look at again) – as an example of reflection (look deeper perhaps over-and-over from different perspectives) – has shown a path for remembering and understanding. In writing this blog post, tired as I am after an all-period teaching day on the first day back at school in 35C heat, I have forced myself to revise and reflect on these strategies.

Ah, I feel wiser now…haha

Learning to code

Software programming hasn’t been taught at my school for years. It was a bit of a gamble for me to include it in my programs for 3 subjects I teach: 9IST, 10IST and 11IPT. I was intending to do programming with the year 9s but decided to extend this to the year 10s in the hope of drumming some interest for the Software Design  HSC course and to the year 11s because the students expressed interest in learning.

Intro to programming

I used different ways to introduce the topic. First up were the year 10s who I got to play with Context Free Art (visual programming) which I barely learned at the CS4HS at Sydney Uni a few days before. Next up were the year 11s and I took them straight to Python for Beginners course with groklearning; the first couple of modules are free and sufficient to get beginning programmers going. Finally, with the year 9s, I went completely analogue. In groups of 3, they had to design a dance move for 8 beats and write it in pseudo-code. Another group gets to execute the move using the pseudo-code.

The year 9s had the best fun and, in my opinion, really learned what it means to design and code software programs. They experienced the challenge of breaking down the problem (dance move) into smaller components and think of sequencing, concurrent processing and even looping. Then there was the challenge of coding the move. Also, they realised that code – if unclear – could be interpreted in different ways or worse, wrongly (not as designed). They got the big picture: developing algorithmic-thinking and coding skills.  As quoted from @gilfer in a previous post, Software is poetry

… programming is not really the practice of writing lines of code. It is the art of taking big, intractable problems and breaking them down into ever smaller ones which can be understood, explained and then carefully assembled into a living, breathing work of art.

Software is poetry. It’s the expression of ideas in the most elegant form a programmer can devise.

Learning Python

I really enjoyed my road-test of NCSS challenge last year and so changed my new school’s IST course so I can include it in (he he).  As mentioned, both my years 9 and 10 are doing the NCSS challenge 2013 in its spiffy new groklearning platform. It fits right in with the IST syllabus (core topics + software design option) as well as my experiential approach to teaching. I even decided to make this one of the assessment tasks for year 9s; I’d have done the same with year 10s except their doing exams instead.

Both classes started the challenge today – Beginners. Starting with a quick campfire, I told them about pair programming (one of the strategies I learned yesterday as good for success in introductory programming – go on read it; I will try the other strategies later) and of course, remind them to have fun. It’s too early to tell but hey, I’m excited because the students were totally engaged in the challenge and were having fun….hard fun….as in, easy is boring kind of fun.  In both cases, I had to boot them out at the end of the period as they wanted to keep going – and we’re talking they’re supposed to go to recess or lunch….not another subject that perhaps they don’t like!

Perhaps it shouldn’t have surprised me but the year 9s did better than the year 10s. Was it the dance move intro? 🙂

There are a few year 9s who I will have upgraded to the Intermediate challenge as Beginners seem too easy for them. #proudmoment

I thought I’d share my here as well; feel free to reuse, upcycle, remix – if you do, all I ask for is feedback to how it can be better….atrribution would be nice, too. 2013 – 9IST – Assessment 3 – NCSS (PDF)

Using ClassDojo

I used ClassDojo before when I first ran my Digital Media Jedi Academy (also for 9IST). As before, I’m using it to communicate my expectations and award points. The points this time is for a request for an in-school competition outside of the national challenge. I do listen to my students and besides, using ClassDojo really forces me to look at each kid and see if they are showing expected behaviours…and my favourite is “exceeding expectations“. In this way, ClassDojo is my tool to remind me to check in with every kid as I have a visual reminder of eveyrone in my class and the ones who are not racking up points (are they not showing the expected behaviour or am I just not seeing it – go look, Mrs Mawby!). The points system is handy also for the teacher observation component of the 9IST task.

In case you’re wondering, I’m not using the Negative Behaviours (removing points) because in my 6 months with these classes, I’ve never had reason to control negative behaviour….yes, I’m lucky.

expected behaviour

expected behaviour

 

Okay, have shared heaps now and will stop – just wanted to leverage the excitement of the day to churn out a blog post 🙂

UPDATE 12 August 2013: I just added the task in PDF (I forgot to attach it last time….oops!)