Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Data Structures and Algorithms with OO Design Patterns in Ruby

By Peter Cooper / April 24, 2007

Cs
Data Structures and Algorithms with Object-Oriented Design Patterns in Ruby is an online book (free to read!) by Dr. Bruno R. Preiss, an incredibly well qualified engineer and computer scientist. It covers all of the various data structures and algorithms that beginning Computer Science students have to learn, but from a Ruby perspective and using object oriented design patterns.
The book itself is now a few years old, but I've only just come across it and it still seems relevant although, rather sadly, the on-page code is in graphics only (a ZIP file containing the source is available) and feels like a line-by-line conversion from C++ rather than true Ruby code. Still, if computer science, data structures, and algorithms elude you to any degree, and you want to learn about them while following Ruby code, it's a good place to start. There are also versions for C++, Java, C# and Python available from Bruno's homepage.

Comments

  1. Mike Woodhouse says:

    While its always good to have more references (I suppose), if the awful piece of sample code presented is typical then this will have to wait some time before it gets to the top of my reading list. Why? Array already supports push() and pop() out of the box, and top() if you can stand to translate to first().

    Goodness knows what the Stack implementation looks like. Some sort of linked list in a language without explicit pointers? Maybe he used an array? Ugh.

  2. Mike Woodhouse says:

    Oh. I couldn't resist it - I peeked.

    Ghastly ghastly ghastly.

    Talk about not getting it.

  3. Peter Cooper says:

    You are right, it is pretty atrocious ;-) I'm certain it's just a line for line conversion from C++.

    However, I think the point of the text is to teach about structures and concepts rather than best practices per-se.

Other Posts to Enjoy

Twitter Mentions