Изменения

Перейти к: навигация, поиск

Красно-черное дерево

52 байта убрано, 23:20, 11 июня 2018
м
фикс табуляции
grandfather.colour = red
rightRotate(g)
'''else'''
'''if''' grandfather.left != ''nil''
uncle = grandfather.left;
'''if''' uncle.colour == red
<font color=green>// случай, когда "дядя" красный </font>
t.parent.colour = black
uncle.colour = black
grandfather.colour = red
t = grandfather
'''else'''
if grandfather.left != ''nil'' uncle = grandfather.left; if uncle.colour == red <font color=green>// случай, когда "дядя" красный </font> t.parent.colour = black uncle.colour = black grandfather.colour = red t = grandfather '''else''' '''if''' t.parent.left == t t = t.parent rightRotate(t) t.parent.colour = black grandfather.colour = red leftRotate(grandfather)
root.colour = black <font color=green>// восстанавливаем свойство корня </font>
1
правка

Навигация