Back to Intro CS: the Perks of Recursively-Defined Data Structures

I chose to work on the B-tree library because it sounded a lot like the projects I used to work on in my freshman-year intro computer science class.  And it is, in a way: I’m using a recursively-defined data structure to hold the B-tree’s information, but instead of two levels of recursion, I have four!  What I mean by this is, rather than having an empty tree and a “full” tree under the heading of a binary search tree, with the B-tree, I have the tree structure, the node contained at each level, whether the node is a branch or a leaf, and what’s inside the node.  This sounds confusing at first, and it was definitely hard to keep track of in the beginning, but I definitely appreciate the trickle-down I get.  That is to say, if I want to test a to_str() method for the top-level tree, I can, in the same test, look at the to_str() method for all of the nested data structures also.  It seems like it’s going to save me a lot of typing.

In funny and unrelated news: my competitive programming partner and I received free flash drives for having the last submitted answer (with less than five minutes on the clock) for the ACM ECNA contest.  We placed 50th overall, which was the last place for all teams solving two or more problems…but we were the only team from our school to solve more than one problem!  I’m still proud about this, and the contest happened over a month ago.

This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s