Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Algorithms

Hashing

Pigeonhole Your Data

Issue: 1.4 (February/March 2003)
Author: Matt Neuburg
Author Bio: Matt Neuburg is the author of REALbasic: The Definitive Guide, and a member of the editorial board of REALbasic Developer Magazine.
Article Description: No description available.
Article Length (in bytes): 10,644
Starting Page Number: 34
RBD Number: 1417
Resource File(s):

Download Icon 1417.sit Updated: Friday, October 17, 2003 at 12:20 PM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

Here's a problem that arises frequently in computing: You're going to be handed a lot of items of data, and then shown a new item and asked whether you've already been handed one identical to it, and if so, where you put it. This is a problem that arises in real life, and we can use real-life reasoning to analyze it. Suppose, for example, that you are a doctor with two or three hundred patients. You've got a file of information on each patient; when a patient comes in for an appointment you'd like to lay your hands on that patient's file. How do you store the files?

You could just have a room where all the files are thrown helter-skelter on the floor; but this would not be very efficient. It guarantees that all the files are in one place, but you might have to examine every single file in order to find the one you want. A better answer is, of course, a filing cabinet. For purposes of discussion, let's imagine a filing cabinet with 26 drawers. If each drawer is labelled with a letter of the alphabet, in order, then we could use the first letter of a patient's last name to tell us where to put that patient's file -- and where to find it again later. Instead of a big room containing all the files we've now got 26 little rooms, each containing just a few files.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com