Skip to Main Content
Programming Pearls, 2nd Edition
book

Programming Pearls, 2nd Edition

by Jon Bentley
September 1999
Intermediate to advanced content levelIntermediate to advanced
256 pages
7h 38m
English
Addison-Wesley Professional
Content preview from Programming Pearls, 2nd Edition

Column 3: Data Structures Programs

Most programmers have seen them, and most good programmers realize they’ve written at least one. They are huge, messy, ugly programs that should have been short, clean, beautiful programs. I’ve seen several programs that boil down to code like this

if (k ==   1) c001++if (k ==   2) c002++   ...if (k == 500) c500++

Although the programs actually accomplished slightly more complicated tasks, it isn’t misleading to view them as counting how many times each integer between 1 and 500 was found in a file. Each program contained over 1000 lines of code. Most programmers today instantly realize that they could accomplish the task with a program just a tiny fraction of the size by using a different data structure — a ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The Practice of Programming

The Practice of Programming

Brian W. Kernighan, Rob Pike
The Programmer's Brain

The Programmer's Brain

Felienne Hermans
Programming Interviews Exposed, 4th Edition

Programming Interviews Exposed, 4th Edition

John Mongan, Noah Suojanen Kindler, Eric Giguere
Programming Rust, 2nd Edition

Programming Rust, 2nd Edition

Jim Blandy, Jason Orendorff, Leonora F. S. Tindall

Publisher Resources

ISBN: 9780134498058Purchase book