lkml.org 
[lkml]   [2008]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] B+Tree library
Johannes Berg wrote:
>> +static inline size_t btree_visitorl(struct btree_headl *head, long opaque,
>> + visitorl_t func2)
>> +{
>> + return btree_visitor(&head->h, &btree_geo32, opaque, visitorl, func2);
>> +}
>
> Incidentally, do you think it would be possible to implement a kind of
>
> btree_for_each_entry(e, ...) {
> do something with e
> }
>
> macro or function/macro combination? You seem to be doing a recursive
> walk across the tree, would it be useful to have a linked list at the
> lowest level of nodes to be able to iterate more easily?
>
> johannes

What would you expect to be the behavior if you remove 'e' ? That might
cause the tree to get re-ordered. Do you restart the list traversal?

I had a similar issue once with a hash table algorithm where you could
either access elements with a hash key, or efficiently traverse the hash
table using a linked list of elements. The solution wasn't too difficult
in that case because removing an element didn't cause the table to get
re-ordered.

rtg
--
Tim Gardner tim.gardner@canonical.com


\
 
 \ /
  Last update: 2008-10-31 16:21    [W:0.144 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site