alexbol99 / flatten-interval-tree

Interval binary search tree
MIT License
42 stars 22 forks source link

Brother Node left and right = null => cannot read color of undefined #2

Closed valoricDe closed 5 years ago

valoricDe commented 5 years ago

Hi, in the function delete_fixup at

// Go to cases 2..4
if (brother_node.left.color == RB_TREE_COLOR_BLACK &&
    brother_node.right.color == RB_TREE_COLOR_BLACK)

the brother_node has color 1 and a parent node but is otherwise is undefined or null Do you have a idea how to fix this?

alexbol99 commented 5 years ago

Hi, Velten @valoricDe

Do you have a data to debug?

Thanks, Alex Bol

valoricDe commented 5 years ago

Ohh, as I loged all the incoming nodes of delete_fixup I recognized that I used a reference to a internal node with a changed position in the tree, due to a former insert. I shouldn't have used the interla tree_delete function. I thought I could circumvent the additional tree_search. Anyway, thank you for your implementation

alexbol99 commented 5 years ago

Velten, Thank you for your cooperation