Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
theuni committed Jun 4, 2024
1 parent 2603320 commit 3e54b42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rbtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ class Tree

template <int I>
void fix_insert(Node* z) {
while (z != m_roots[I] && !z->m_positions[I].m_black) {
while (z != m_roots[I] && !z->m_positions[I].m_parent->m_positions[I].m_black) {
if (z->m_positions[I].m_parent == z->m_positions[I].m_parent->m_positions[I].m_parent->m_positions[I].m_left) {
Node* y = z->m_positions[I].m_parent->m_positions[I].m_parent->m_positions[I].m_right;
if (y != nullptr && !z->m_positions[I].m_black) {
if (y != nullptr && !y->m_positions[I].m_black) {
z->m_positions[I].m_parent->m_positions[I].m_black = true;
y->m_positions[I].m_black = true;
z->m_positions[I].m_parent->m_positions[I].m_parent->m_positions[I].m_black = false;
Expand Down

0 comments on commit 3e54b42

Please sign in to comment.