Stacks & Queues
Like recursion, good applications motivating stacks, queues, and
priority queues appropriate for CS 2 are hard to come by.
Stacks
Queues
Priority queues
Though most books use stacks and queues as their first data
structures, I find it useful to do them later. Two reasons:
- The rationale behind teaching stacks and queues isn't that
they're handicapped versions of lists; it is because they show up
in more advanced algorithms. So it makes sense to do them later,
when students know more about the types of algorithms where they
are likely to be used.
- I have my students do large free-form projects in the later half
of the course. They need to understand sets and maps for this; to get
that into the first half, I have to push back as much as possible to
the back half.
(next)
(schedule)