From: Daniel T. <dan...@gm...> - 2009-07-07 15:29:55
|
Jann Röder wrote: > Hi Daniel, > I don't have a sample for all bugs. I will probably try to reproduce > it again later, but for starters: I was able to reproduce the bug and know how to correct it. The problem is that one should never iterate like that through a DS_BINARY_SEARCH_TREE_CONTAINER and use `remove_node'. I will correct that as soon as possible. The problem is likely to be present in all set operations that remove items - certainly only in the binary search tree classes. > * subtract does not reset the found_item, thus causing weird behavior > in has_key. The has_key implementation seems strange anyway. Why do > you use a class variable as iterator. Locals are faster and easier to > understand. I think the search feature should set found item to Void > in the beginning. `found_node' is used to avoid redundant searches through the tree in `search_node'. E.g. if you first call `has (a_key)' and then `at (a_key)', then during the second call, the tree does not need to be traversed, as the result is already present in `found_node'. At the time when I implemented all those classes I was not aware of the huge performance difference between attributes and local variables. I will change that as well in the loop. Thanks for reporting the problem |