4

I am faculty of computer science. Currently, I am teaching a design and analysis of algorithms course to second-year undergraduate students. This is my second semester of teaching before this I have done a Teaching assistantship during my Ph.D.

I am feeling like 50 percent of my class is not understanding what I try to teach in the class there 10-15 percent of students have understood the content I have taught. This observation comes from the result of the quiz I conducted last week.

I have tried my best to teach algorithms, I use slides and a board (50-50 percent time). Always starts with two-three examples and then discusses the cases of algorithms and ask questions in between trying to take the response from students and at the end presents the algorithm. I do problem-solving one time a week.

I want to engage students to participate in the class but only fractions of them seems interested like 20-30 percent. When I do problem-solving then participation is more it is around 50 percent.

Kindly suggest some techniques to make the course more interactive and create interest in most of the students.

Buffy
  • 35,808
  • 10
  • 62
  • 115
Shi
  • 43
  • 3
  • 1
    Have you kept in mind the fact that simply some of them (even maybe up to 50% of them) may not be interested in algorithms at all? They may be aspiring frontend developers, DevOpses, network administrators... CS is about the broad knowledge revolving around computers and students need to be able to grasp at least the bare minimum of everything you teach there, but from my experience peaks of 50% of the students actively participating in any algorithms and data structures courses is a very decent result. You can't engage everyone. Without more details, it's gonna be hard to offer decent advises – Fureeish Apr 18 '22 at 11:00
  • 4
    @Fureeish, that sounds very wrong. A CS degree isn't a jobs program. It is an education program. – Buffy Apr 18 '22 at 11:26
  • 1
    What do you mean by "interactive"? Or do you intend "active learning"? Not quite the same thing. How many students do you have? – Buffy Apr 18 '22 at 11:27
  • 2
    @Buffy why would that sound very wrong? And while I agree that in principle, CS degree is not about landing a job but about obtaining knowledge, ultimately this knowledge is meant to be used. Majority of CS students want to land a job after they finish university. If your students mostly consist of people that seek knowledge just for the sake of seeking knowledge, I do surely envy you. And I believe that CS degree should be on par with current jobs' requirements and expectations. – Fureeish Apr 18 '22 at 11:45
  • @ Buffy, Class of size 60. Interactive means students participate in the activities which I do in the class. Like if I aks something then they respond and given me answers /opionions. – Shi Apr 18 '22 at 14:43
  • @ Fureeish Yes students here are mostly interested in Webdesign, full stack development etc. – Shi Apr 18 '22 at 14:44
  • @Shi Does this course use a textbook like Skiena's *The Algorithm Design Manual*? I am asking because some algorithms courses are oriented towards the theoretical, while others are oriented towards the practical, encouraging experimentation by the students. I am a hands-on learner myself. When I was a CS student (a long time ago; retired software engineer now), the first kind of class would bore me to no end, while the latter kind would get me all fired up, inspiring me to experiment and research the literature beyond what was needed for class. – njuffa Apr 19 '22 at 22:59
  • @Fureeish There are algorithms in front end. sort, search, square-root, etc are not the only algorithms.And front-end devs will use the back-end algorithms. Get them interested in how to choose an implementation. Teach then algorithms that are relevant to them. – ctrl-alt-delor Apr 20 '22 at 10:11
  • @ctrl-alt-delor I really dislike arguments like these, because one can strech them further indefinitely. Should an aspiring web-developer learn assembly because - after all - the code they write will be transformed into it? I don't think so. It's *good* to have a basic understanding of it, but it won't be pleasant for everyone. Algorithms are a little bit different. They are way closer to maths. Should everyone learn maths? Yes, beacuse it teaches *a way of thinking*. Should everyone at a CS program learn algorithms? Yes, for the same reason. Will everyone enjoy maths / algorithms? No, never. – Fureeish Apr 20 '22 at 10:50
  • @ njuffa, I assign problems from the skiena's book but I cover theory part from coreman or jeff erickson's lecture notes. – Shi Apr 20 '22 at 13:43

4 Answers4

4

I'm a bit worried about the scale here, but I often did some interesting things when there were fewer than about 30 students. Maybe you can make it work. I'll give a couple of examples using sorting. To do them you need a bunch of cards (maybe bigger than index cards at this scale) and a marking pen.

Call it playtime. (Done with university students in a CS major)

Write a bunch of integers on individual cards (probably about eight cards). Hand them out to a bunch of students, one card each. Have them stand in line facing the class with the numbers in random sequence, cards visible.

Insertion sort:

Have one student not in the line point to the second person in the line from the left side of the line.

Pull the person pointed to out of line, compare their number with that of the first person and if the number is less, push (gently) the first person down to the now empty (right) slot to make a slot for the one you pulled out and push them into the open slot.

Tell the "pointing student" to point one person farther on. Go there, pull that person out of line and then move down toward the left, pushing people right as long as their number is larger than the one you've pulled out. Put them into the now empty slot. Repeat.

The quadratic sorts are all pretty easy to manage. The faster ones can be done (with mistakes and lots of laughing) using some students as data and other students as pointers. Merge sort might be the hardest, but note that with some practice it can be done in parallel. But first practice merging as a separate "play".

For quick sort you might be able to have about 16 data points and fewer might not give enough data to help the students grok the method.

Searching is also possible and a bit simpler. One or several "pointer" students to keep track of things.

I also did some general recursion lessons having one student with a "base case" script and adding additional students to a list with a different script that, say, either returned a value or passed the process down toward the base case. I'd guess that tree algorithms might be too messy to manage, though.

You can do something similar (with care) to teach linear recursion by adapting There was an old lady who swallowed a fly into what I called choir practice. The base case is "'I don't know why she swallowed a fly, perhaps she'll die'". You need to be choir director feeding the initial lines of each verse and handing a card to a new student with their lines.

You say, at one point, "There was an old woman who swallowed a cat. Imagine that, to swallow a cat". Hand a new student the card "She swallowed the cat to catch the bird" who reads the card aloud, and points to (recurses) to the next person whose card gets read again ("She swallowed the bird to catch the spider") and passes control (points to) the next student.

Note that you (choir director) terminates when you reach the "horse" verse.

Buffy
  • 35,808
  • 10
  • 62
  • 115
2

You could provide working code, load it into an IDE, and start a debugger. Stop at lines of code that are interesting. Or make a dump of data structures that are interesting. Perhaps during each iteration (or before and after an operation. To show how linked lists can grow, for example.
Demonstrating the basic usage of a debugger is valuable to anyone.

You could also Benchmark some different variants/implementations of certain algorithms and ask in advance, which variant might run faster. You could do this in form of a poll (in your videoconferencing software) or just asking "Raise your arm if you think algo 1 is faster".

Let them benchmark on their machines and report results, to demonstrate that some results depend on hardware, on many factors.

knb
  • 131
  • 4
  • My professor tried the first method. Nobody understood anything. 2nd year students don't understand what a debugger is and why they'd ever need it. – arunkumaraqm May 20 '22 at 18:54
2

I used to teach some search and sorting algorithms but now my favorite teaching example is Euclidean algorithm (GCD), for couple of reasons,

  1. It was probably the oldest algorithm. I can also talk about some history, one of my favorite subjects, but more importantly makes kids engaged.

  2. Let them prove it themselves. It is quite easy and again makes them engaged.

  3. Help them review/refresh recursion.

  4. The most important reason I used it now is that the most popular video stream website in China, called bilibili (you can see it as the top TikTok competitor in China for young generation) crashed for almost 10 hours in 2021.07.13 for exactly a hidden bug in its implementation for GCD, written lua, check here for detailed, but it is in Chinese. So I will briefly explain here: they developed this innocent lua script for GCD for their OpenResty web server. In 2021.07.13 under an extremely rare condition, the b parameter it got was '0' instead of 0, so the lua script became an infinite loop and drain the whole computer cluster to death.

This real life example makes the whole discussion "interactive"!

GCD

--- update ---

Recently I teach the binary search and re-read this old article again "Extra, Extra - Read All About It: Nearly All Binary Searches and Mergesorts are Broken"

I remember vividly Jon Bentley's first Algorithms lecture at CMU, where he asked all of us incoming Ph.D. students to write a binary search, and then dissected one of our implementations in front of the class. Of course it was broken, as were most of our implementations. This made a real impression on me ...

So maybe like what he described there, ask your students to implement a binary search in class. I don't do that because my students are highschoolers but for college students I feel it is appropriate.

Qiulang 邱朗
  • 828
  • 3
  • 14
1

CS50 was open-source last time I checked... it's a very well designed curriculum. I remember there were people worlwide using their material to teach computer science. Just make sure their policies and licenses haven't change.

CS50 is the introductory course of Computer Science by Harvard University. You can find the material at https://www.edx.org/course/introduction-computer-science-harvardx-cs50x

Daniel N.
  • 11
  • 2