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.

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

Multimedia PBL and wrestling with the marriage problem

After a term break from PBL, I’ve gone back to it with both my 9 and 10 IST classes. I’ve been meaning to share the ‘idea’ but just haven’t got there (Is it really week 4 now?). Anyway, I’m glad I’m doing PBL again now as well as incorporating some of the things I’m learning as I do my Masters in Special Ed.

So then, in this post I’ll share my 10IST PBL plus a (rough) lesson plan that targets content (IST: problem definition, GUI design) as well as an example of teaching approach that promotes active response (one of the effective teaching principles I’ve learned about recently).

PBL

PBL_HowCanMMengageLearners

We’re about a third of the way in and most of the theory have been covered (via direct instruction) by  now. However, I’ve noticed that while students ‘get’ the idea of what engagement looks like or what ‘good’ GUI looks like, I wasn’t convinced that they’ve wrestled with it enough to apply in their own projects.

(rough) Lesson Plan

So I designed this lesson to show how a topic could be presented online in three different ways. The topic is a probability problem popularly known as the marriage or secretary problem.

I divided the class into discussion pairs.

First, I showed the wikipedia version which provided a  brief description of the problem. Discussion was first done in pairs and then as a class. This is the first time the class have heard of the problem so there was a lot of “I don’t get it” and a few, “yeah, I’ve encountered that problem heaps of times”.

Then, I showed this academic article version which provided, as expected, a more academic description of the problem and solutions. There were ‘whoas’ as we scrolled through the voluminous and dense text blocks and equations. Again, discussion pairs followed by class discussions. We got to unpack some of the GUI principles to do with form, function, navigation, layout, etc. just by comparing this with the wikipedia version. They were applying the content previously learned, both in terms of concept and language. Their analysis of GUI design is becoming more sophisticated and this is awesome.

Finally, I showed this NPR article with a sensationalist and attention-grabbing title of How to marry the right girl: a mathematical solution (thank you @fawnpnguyen for the inspiration!). We went straight into class discussions on this one and highlighted which GUI principles made this one more engaging, including the use of graphics and share/comment buttons – a feature they may well include in their projects.

There was also a bit more discussions when one of the students piped in that she thought the wikipedia version was more engaging with its neutral tone and predictable structure. This emphasised one of the key things in the design process, i.e. problem definition and how wikipedia addresses a different problem (and audience) than the other two. Engaging‘ then, is relative (gotta love those lightbulb moments). Therefore, as they set off creating their own solutions (project product), they need to be mindful of the problem they are actually trying to solve.

Then, I asked them to create their own version of the topic in what they think is engaging. Students challenged themselves to learn more HTML and CSS tags and JS scripting, based on what they want to learn and incorporate in their own projects.

Sometimes lessons work according to plan, if not better. This was one of those. It can be better but I sure was pretty happy with it.

Discussions in pairs and whole-class with plenty of opportunities to raise and answer questions as well as working in pairs with plenty of opportunities to synthesise are strategies for active response to help with learning engagement. Students are constantly wrestling with the content from different angles. 

An exciting footnote:

The student who preferred the wikipedia version went on to do more research on the marriage problem because she really wanted to understand it (she was in the minority, I assure you, but enough to make this ex-maths teacher a little bit happy). And in doing so, has illustrated yet again the beauty of tangential learning and the power of inquiry driven by curiosity.

Python Revision FUN

With Year 9 exams next week, I spent some time today revising some software development concepts with my class. With the end of NCSS Challenge ending a few weeks ago, it’s been a while since my students last coded in Python.

The focus today was on errors (ha!) particularly desk-checking and variable tracking. So, I wrote this code on the board:

code part 1

I got student volunteers to write out the values for variables: sites, mysites, i, len(mysites) and print.

Short as this code may be, it provided plenty of opportunities to revise a fair bit of content. Anyway, the sites the girls elected to have were Google, Apple and Sony, so print showed:

Option 0 Google

Option 1 Apple

Option 2 Sony

We then went on to editing the code to start printing from Option 1, instead of 0, etc., followed by this bit code (with opportunity to correct syntax errors for relational operator and if statement):google2And thus updating the value of print to show:

Option 1 Google

This is where we’re going

and I kept writing ‘on November 5′

We’re really going to Google?”

Are we really?”

Plenty of squeals and smiles.

To which I can only reply, “Wasn’t that a fun way to break the news?” *do it in code*

Two birds with one stone. And happy students to boot. Got to love that!