You are previewing Code Complete, Second Edition.

Code Complete, Second Edition

Cover of Code Complete, Second Edition by Steve McConnell Published by Microsoft Press
O'Reilly logo

Stair-Step Access Tables

Yet another kind of table access is the stair-step method. This access method isn't as direct as an index structure, but it doesn't waste as much data space.

The general idea of stair-step structures, illustrated in Figure 18-5, is that entries in a table are valid for ranges of data rather than for distinct data points.

The stair-step approach categorizes each entry by determining the level at which it hits a "staircase." The "step" it hits determines its category

Figure 18-5. The stair-step approach categorizes each entry by determining the level at which it hits a "staircase." The "step" it hits determines its category

For example, if you're writing a grading program, the "B" entry range might be from 75 percent to 90 percent. Here's a range of grades you might have ...

The best content for your career. Discover unlimited learning on demand for around $1/day.