The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Binary trees, non-unique values by mikosullivan2002-06-12 05:04:11
  What I'm going to try by mikosullivan 2002-06-12 08:38:06
Thanks for the help on indexing. The suggestions were similar to what I'd been thinking of, so maybe I'm not so far off the mark after all. Here's the plan:

For unique indexes, the index information information will be stored along with the record as a binary tree:

  • Pointer to parent node
  • Pointer to lesser-than node
  • Pointer to greater-than node

For indexes in which the indexed data is not unique, here's how the information will be stored. There will be a separate table for unique nodes: each unique value is stored in a record and is organized in a binary tree. That index table works just like regular tables, except that is doesn't store the first or last record positions or the previous and next positions in each record. Each index record contains:

  • The data being indexed
  • Pointer to parent node
  • Pointer to lesser-than node
  • Pointer to greater-than node
  • Pointer to last data record
  • Pointer to first data record

Each data record contains:

  • The data being indexed
  • Pointer to previous record with identical index value (first record points to index node)
  • Pointer to next record with identical index value (last record points to index node)

Eventually I'll implement red-black balancing, but that will be a little bit down the road.

In case anybody is interested, I'm programming a small-footprint, single-file database in Perl. I don't feel that the current open-source databases out there meet the needs of the average user in terms of simplicity of database creation and use. Besides, I've always wanted to try prgramming a DBA system from scratch. Anybody who is interested in helping out is welcome to contact me.

-Miko

[ Reply ]

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)