I feel that min heap is the best data structure for this kind of requirement.
 
Any comments?
 
regards
Arunachalam.

 
On 11/22/05, adak <[EMAIL PROTECTED]> wrote:

Yes, you have to re-sort the indexes for every record you add, however,
you FIND that index number by a simple binary search (very fast), which
you slightly modify for that purpose.

Then, all you need to do is increment each of the current index
numbers, by one, if they are above the number that has been found
through the binary search, just a simple increment.

The alternative I see is completely re-sorting all the indexes, or
worse yet, all the struct's.

Surely, that's a worse complexity. <grin>

Dave




--
===================================
want to know more about me
http"//ww.livejournal.com/users/arunachalam

Reply via email to