It's the end of the semester, so my students are pretty burnt out, and a bit of sugar might go a long way (plus, evaluations are around the corner ;-). I'm envisioning a tactile class where students would carry out the selection sort algorithm to sort an array of candy bars by length (or height, or size), by physically swapping candy bars. I would also have them write down the number of comparisons required, to get a better understanding of the time complexity. Ideally, every student (or pair) would get 4 pieces of candy.

Can anyone suggest candy that naturally comes packaged into 4 or more different sizes?

All I could think of is how Hershey bars can be broken along natural dividing lines into different numbers of squares, and how Toblerone bars also have natural break points. But both are chocolate and might melt. I'm embarrassed to admit I'm not much of an expert on candy bar types.

  • $\begingroup$ Refined sugar is a dangerous addictive substance. $\endgroup$ – ctrl-alt-delor Apr 18 '19 at 19:56
  • $\begingroup$ Related: cseducators.stackexchange.com/a/2973/204 $\endgroup$ – ctrl-alt-delor Apr 18 '19 at 20:04
  • $\begingroup$ Hi. I don't think your first comment helps me at all, and your answer to that other question is not relevant to my question. My students are not implementing an algorithm. They will be carrying it out, having read it the night before and done reading questions on it. $\endgroup$ – David White Apr 19 '19 at 1:21
  • $\begingroup$ What I described was not coding. It is doing. Yes I used the word implemented, but did not yet mention what hardware. Later it becomes obvious that it is run on the humans (students), with some playing cards. $\endgroup$ – ctrl-alt-delor Apr 19 '19 at 7:04

Actually, I might suggest a slightly different tact: provide a variety of candies (small boxes of nerds, Hershey's kisses, and the like) and have them selection sort by preference order.

They can also sort by height, brightness, weight, or duration of the candy experience.

And as long as you're at it, you might first have them just sort it one of those ways however they do it naturally, which can lead to a nice discussion about why we can't articulate what we're doing very well, but it's some sort of massively parallel selection sort.

Then you can do a number of sorts, culminating in your selection sort by preference order. And at the very end, tell them all to look around at their neighbors sorts to see if there are any obvious trades that they should be making!

  • $\begingroup$ I decided to go with a combination of this idea and with Twizzlers, which slice into sub Twizzlers of varying lengths and hence get sorted into something that looks like a triangle. But, I'll also give students a variety of candy after the sorting is done, and encourage them to use what they've learned about swapping to achieve an optimal snack. I like the point about how the massively parallel selection sort of the mind doesn't translate well to an algorithm. $\endgroup$ – David White Apr 19 '19 at 1:19

This sounds like a bad plan. Students won't learn much of anything by sorting four items. Especially if they can "see" all of the remaining items. They don't need a scan if they can visually select the next item.

I suggest that you sort tokens instead. Then use the candy as prizes for various things, or just make it a sorting "party" where the yummies are free.

You need around 10 or so tokens for each group to get any sense about efficiency. And you need to write instructions, especially for selection sort, that make it impossible to see all of the values at once. One way is to use "poker chips" with numbers on one side. When face down you have to examine them one at a time.

Make sure that whatever sort you use and whatever props that you don't make it possible to use non-algorithmic human capabilities like sight or touch to avoid following the rules.

Safety note. Your profile says you teach college. For those teaching youngsters, however, note that not every kid can handle sugar for medical reasons. Other treats might be necessary.

  • $\begingroup$ Thanks for sharing! I'll get some tokens for future classes. $\endgroup$ – David White Apr 19 '19 at 1:20

My personal favorite way to teach sorting is with rubber ducks. I have a large set of ducks that have numbers on the bottom. Since they sit with the number covered, the students have to pick up a duck to check the number.

You could do something similar with candies if you wanted, where you write a number or letter or something on the outside of the package that will sit face down.

  • 1
    $\begingroup$ Thanks for sharing! $\endgroup$ – David White Apr 19 '19 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.