O'Reilly logo

The Ruby Way: Solutions and Techniques in Ruby Programming, Third Edition by André Arko, Hal Fulton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. More Advanced Data Structures

A graphic representation of data abstracted from the banks of every computer in the human system. Unthinkable complexity. Lines of light ranged in the nonspace of the mind, clusters and constellations of data. Like city lights, receding.

—William Gibson

There are, of course, more complex and interesting data structures than arrays, hashes, and their cousins. Some of the ones we’ll look at here have direct or indirect support in Ruby; others are “roll-your-own” for the most part. Fortunately, Ruby simplifies the construction of custom data structures.

The mathematical set can be dealt with by means of arrays, as we’ve already seen. But recent versions of Ruby have a Set class that serves this purpose well. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required