Max:

It is O(n).  To be more precise, it is a simple linear search starting with record 0 & 
incrementing through the db.  In pseudo-code:
for (n=0; n<numRecords; n++) { if (bingo) {report success} } {report failure}.

-bob mckenzie, palmsource pdx

-----Original Message-----
From: Max Banin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 7:53 AM
To: Palm Developer Forum
Subject: DmFindRecordByID() working time...


Hello!

How does DmFindRecordByID() work?
Does it use O(log n) search or it's just a O(n) ? :)

for example:
DmFindRecordByID( ... UInt16 *index, UInt32 ID, ... )
{
    .....
    for( i=0;i<records_num; i++ )  // :)
    {
        ....
        if( record[i].uniqueID == ID ) { *index = i; break; }
        ....
    }

}


Thanks,
Max.



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


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

Reply via email to