| Issue 189: | RBTree::Insert has issue when insert a value already exist | |
| 1 person starred this issue and may be notified of changes. | Back to list |
After read the code of RedBlack.h, I found the RBTree::Insert has a issue when insert an exist value:
/*
Stop working if we inserted a node. This
check also disallows duplicates in the tree
*/
if ( q->key== inKey )
{
q->value = inValue;
break;
}
When value already exist, it breaks the loop, but at the end of this function it still increased the "size":
/* Make the root black for simplified logic */
root->red = 0;
++size;
Feb 1, 2013
Project Member
#1
gameh...@gmail.com
Status:
Fixed
|