At 17:31 2002-11-21 -0800, you wrote:
> Ho do you keep the records sorted in an efficent
way?

That's not a concern in my case, because the database
is read-only.  I provide a pre-sorted database (pdb)
to my users on a regular basis.

If you have updates on the handheld, you could
probably just find the correct position on the
sorting order using DmFindSortPosition and then
insert the new record(s).
This looks like a job for Computer Science!

If you look at b-tree algorithms, you may be able to find some ideas that would work for you. They work like a binary tree, except that each node has multiple records, and can have multiple children. One idea is that each node has a maximum size, and there are operations that are done to split nodes if they grow too large, and combine nodes when they get too small. Since the whole tree still observes a sorted nature, finds are fast, very quickly resulting in finding the node that has the item if present.

There are a nunber of variations, but I'd bet a linear b-tree node handling algorithm would work pretty well.

--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com


--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to