OSU eCampus CS261 Data Structures review & recap

This post is part of an ongoing series recapping my experience in Oregon State University’s eCampus (online) post-baccalaureate Computer Science degree program. You can learn more about the program here.

Six-word summary: Loads of implementations, light on context.

Heaps, AVL trees, hash tables, and a whole bunch of ways to sort data – you’ll do it all in CS261, but you might finish the course wondering why.

CS261 Review

This class is all about data structures. Some colleges combine data structures and algorithms into one semester-long class, so I’m happy that Data Structures got its own dedicated 10 weeks in OSU’s program.

Some of your new friends in CS261

Class structure

  • 10 weeks
  • 6 assignments total, evenly distributed through the quarter
  • Proctored midterm, proctored final
  • Nice slow-down in assignments and workload as midterm and final approach, giving sufficient time to study
  • Weekly group obligation: 2-5 worksheets to submit as a group (however you divvy it up is up to you) and typed weekly meeting minutes
  • Steady, even workload

The first 4 weeks will revisit topics from CS162, so if you wanted more practice reversing a linked list or resizing an array, you’ll get to do those things again in CS261.

After the midterm, the class spends 1 week on each topic: AVL trees (including tree sort), min heaps (including heap sort), hash tables (open addressing and chaining), and graphs (including Dijkstra’s). Big-O complexity is also covered in the context of the aforementioned subjects.

The video lectures are decent but to truly understand these topics I recommend searching the Interwebs for additional resources. These are big topics and there are many excellent explanations, diagrams, walkthroughs, etc. available on YouTube. (This is just one of them.)

The workload is consistent and gets lighter before the midterm and final, which left plenty of time to dedicate to studying for the exams.

CS261 books: the one they tell you to get, and the one you SHOULD get

I love a good book. The books we used for CS161, CS162, and CS225 were excellent. I did not love the lack of a book in CS261.

Instead of a book, CS261 provides pdfs to read every week. They are dry, boring, and do not display well on a mobile device. There are also worksheets that open with several paragraphs of reading. These are also dry, boring, and do not display well on a mobile device.

For some reason, this is the recommended (but optional) book for CS261: C Programming Language. It’s an okay book, but it’s almost completely beside the point of the class. It’s a reference to the C language. I don’t know why they recommend it – none of the class material relates back to it. If you’ve taken CS161/CS162/CS165, you know enough C++ to hobble along in C until you get your footing. If you run into any trouble (and you probably won’t past the second week or so) you’ll Google your error message, figure it out, and be on your way.

Then, at the end of fall quarter, I joined the CS325 Slack channel in preparation for my Winter 2018 quarter. There, I saw someone recommending the book Grokking Algorithms to incoming CS325 students.

THIS is the book you should buy for CS261.

I ordered it to get a jump start on CS325, but when I opened it my heart sank a bit: where the F*** was this book when I was still in CS261?! 

Every section of this book is concise and clear, with simple explanations and memorable illustrations. Most topics get multiple explanations and diagrams. The book covers so many topics and I’m just kicking myself for not having this book while I was still in CS261.

Grokking Algorithms has everything from visualizing Big-O runtimes…

to performing a search on a graph…

to adding neighbors as you traverse nodes on a graph…

to sorts, complete with graphs, Big-O complexities, and pseudocode…

to understanding how the stack can be used to perform a set of instructions recursively.

This is just a small sampling of what’s in this amazing book.

I wish someone had told me about this book before I waded through CS261’s long, tedious PDFs on these subjects (which often felt like they were written for people who already understood the topic).

Do yourself a favor. If you are about to take CS261, get this book and refer to it often. It is way better than the materials they provide you in the class.

CS261 uses C, not C++

I’m pointing this out because I see a lot of questions (and complaints) about the switch to C from C++ in CS261. It’s true: unlike CS161 and CS162, CS261 assignments use the C language. HOWEVER – it’s really not a big deal. Any panicky feelings you may have over this at the start of the course will soon pass.

Instead of this:

for (int i = 0; ...)

you’ll do this:

int i;
for (i = 0; ... )

And you’ll write comments like this:

/* comment goodies here */

Little things. Nothing you can’t solve with a quick Google query and by the 2nd or 3rd week you’ll probably forget you even went through this.

They ask you to use an IDE… but you don’t need to

This surprised me: CS261’s first week includes an assignment in which you bring your code into an IDE and then submit a screenshot to show you did it.

As far as I could tell, there’s no reason to keep using the IDE past week 1. You don’t have to choose a particular IDE (or an IDE at all) for the sake of CS261. The class doesn’t teach you how to use the features that make an IDE worth using, like using the IDE’s debugger to step through code.

I tried CodeBlocks for a week, but it crashed so often it was a serious roadblock to productivity until I dumped it and went back to Sublime Text. (I’m on a Mac and the last release of CodeBlocks is from 2013 – maybe that was part of the problem.) 

An IDE is just a tool, and I feel like which IDE you choose is a personal choice and none of the school’s business unless the class is going to teach specific features of that IDE or provide workflow tools that only work with the IDE, which CS261 does not. There’s no reason you should have to abandon whatever tools you’re already comfortable with. This was a strange requirement, in my opinion.

CS261 assignments

The 6 assignments are like “coding madlibs” – they provide you with a collection of files and you fill in the functions that are missing code. The assignments offer little opportunity for creativity, which probably makes grading them easier but also made them more forgettable.

The real shortcoming with the assignments was the missed opportunity to tie the data structures and sorts to real world applications. The greater context of why you might choose a particular data structure or how to analyze a problem and then decide what data structure or sorting algorithm to use is, sadly, largely absent in this class’s materials.

I felt like the “fill in the blank” nature of the assignments didn’t help my brain make links between Real Life Problems and All That Code I Wrote in a Vacuum for CS261.

Here’s a ton of code I wrote. What’s it for? Getting a good grade in CS261, of course.

This “missing context” was further illustrated to me when I told a friend about the class I was taking, and he posed a question:

"Suppose you have a million images. Filenames/filesize/etc. don't matter, just the content of the image. I give you a new image and you have to tell me if you already have this image in your set. How do you figure it out? What data structures do you use?" 

                                                   - my smart friend

CS261 isn’t going to prepare you for this kind of question.

The solution – and surely there’s more than one – to my friend’s question was basically to hash all the image blobs into a hash table, then hash the new image to figure out where it would go and compare it to what’s in the table. You don’t hash on filename or filesize or anything like that, because with image hashing, you want to go by the content of the pictures themselves.

I include this example not to point out what a dunce I am – I already know that – but to illustrate a missed opportunity in CS261 to tie the course material to real life applications. Here’s some more reading on the image hashing question, if you’re curious.

CS261 group work

The weekly group work is going to be either great or a chore depending on who you get grouped with.

In the first week of the quarter everyone was assigned to a group of 5, with the sorting criteria being our time zones and general availability as noted in a spreadsheet that the instructor shared the week before class started (hope you were checking your email!).

For 10 weeks, my group was responsible for submitting 2-5 completed “worksheets” each week by end of day Sunday and a typed log of our discussion, called “meeting minutes” (basically who said what). I use the term “worksheet” loosely, some of them were solidly in “assignment” territory.

In a perfect world, your group will engage in vigorous, insightful discussion on each worksheet, leading to new insights and reinforced learning. (Some of my classmates assured me this is what they were getting out of their CS261 group experience.)

In the actual world, your group will probably struggle to find a meeting time that works for everyone and cope with weekly absences from the group meeting. Our “discussions” were rather thin – we either agreed the worksheet was easy or hard, and then kind of struggled to find anything else to talk about.

I don’t blame my groupmates, I think the worksheets just didn’t lend themselves well to discussion. There wasn’t anything controversial or debatable about the worksheet problems, just cut and dry “fill in the blank” code.

CS261 exams

The midterm and final exams for CS261 proctored, so you’ll have to go to a nearby test center or get set up with an online proctor. Both exams are 1 hour, 50 minutes long.

The midterm is coding heavy – expect to write methods in Word docs, save out a pdf for each problem, and attach them to the test. Many questions require you to download an image or attachment from the test, open it, and answer the question in the test’s text box. This was a clunky workflow and I was constantly afraid I would accidentally navigate away from the test. The final exam, however, only required one external doc to be produced and attached, and only a couple questions required opening an attachment. (Phew.)

As for what to study: study trivia. There’s a ton of trivia sprinkled throughout this course. You’ll want to memorize the runtime complexity of every sort, when to use what data structure (according to the class materials), properties of each data structure, and so on. A lot of that trivia will show up on the test. I found it helpful to make notecards of little tidbits of info that are sprinkled throughout the lectures and reading materials – they helped, but I was still caught off-guard by some of the questions.

My CS261 flash cards and worksheet organizer were invaluable.

A few final tips for CS261

Do all the worksheets yourself, even if your group comes up with some kind of “worksheet rotation”. By the time this class was done I think I’d done every worksheet at least 2 or 3 times, because they’re good practice for the tests.

Use a visualization tool. This is the one I used – it’s not perfect (I wish it showed individual steps for things like AVL rotations) but it’ll help you check your work.

Print all the worksheets. I didn’t have a printer going into this class but I quickly saw the need for one. Most worksheets provide you with function signatures and helper methods, and your job is to “fill in the blank”. Therefore, I felt it was better to have the worksheet printed in front of me so I could fill in the blanks, rather than working in an editor (or worse, a word processing doc), separated from the rest of the worksheet.

Some of my CS261 final exam prep: I redid the weekly worksheets until I had them down cold, and I printed the questions from the practice final.

Practice on paper, and get fast. The tests are, collectively, over half your grade in this class, so your performance on the exams really matters. I felt pressed for time on both exams, finishing within 5 minutes of the time limit both times. I’ve never really been one to study for tests, figuring I should’ve learned the material during the class itself, but I had to buckle down and get serious about studying for CS261. I made flash cards, practice tests, and put probably 20 hours into studying for the midterm and over 50 into studying for the final.

Knowing the code (implementations) is important, but the final exam (which is 30% of the final grade) focuses more on knowing the step-by-step behavior of altering a particular data structure. Be sure you know how to draw specific kinds of trees and how they change when a node is removed.

Join the Slack channel! Lots of my classmates could be found there every week discussing the homework and answering each others’ questions.

Get the Grokking Algorithms book. Seriously, and while you’re at it, invent a time machine and tell me about this book before I take CS261.

And… that’s it for this quarter! I’ll be in CS325 Analysis of Algorithms next quarter (Winter 2018), so be sure to say hi if you see me (Mandi) on Piazza or Slack!

Reports from other students in the program

Are you also blogging about your journey through OSU’s eCampus CS program? Leave me a comment and I’ll add a link here!