Re: glib binary trees



        Usualy you have to decide between
iteration and optimized direct access.
i.e. the hashmap `get' function should 
be faster than g_list_find.

But you could go for a cross-breed.
meaning something like a hash-map and
a doubly linked list.

this of course would require slightly
more maintanence when storing your
datum. order is kept in the list 
while direct access is made through the
hashmap. you could even have a field in
your data pointing to the list `node'
permitting you to:

data = g_hashmap_get(map, key);
next_data = g_list_next(data->node);


Cheers,
                -Tristan

Axel Bock wrote:

Hi, it me again with another glib question :-)

I need some FAST data store/retrieval mechanisms, and I am using btrees
now. But I miss one thing, and perhaps you have an idea how to achieve
this without brute force :-)

It would be nice not only to have a function which gets me ONE value
to ONE certain key, but some functions like

        key = g_tree_get_next_key(key *min)

which returns the key *next to* the key min.

in example: (stupid, but simple):
imagine a list of all icq users just online in germany. now I want to
have all users with an id greater 1000000. (if 10^6 is stored, than its
easy. but if not, well, what then? in a larger dataset (i.e. IP adresses
of people using a heavy loaded system) I do not see a possibility
without extending glib, but this is a thing I try to avoid :-)

Greetings and thanks in advance,

                Axel.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]