288
правок
Изменения
→Методы
'''Node''' insert( h : '''Node''', key : '''Key''', value : '''Value'''):
'''if''' h == null
'''if''' isRed(h.left) '''&&''' isRed(h.right)
'''int''' cmp = key.compareTo(h.key)
'''if''' cmp == 0
'''else'''
'''if''' cmp < 0
'''else'''
'''if''' isRed(h.right) '''&&''' !isRed(h.left)
'''if''' isRed(h.left) '''&&''' isRed(h.left.left)
'''return''' ''h''
</code>
while (x != null)
'''int''' cmp = key.compareTo(x.key)
'''if ''' cmp == 0) '''return''' x.val '''else''' '''if ''' cmp < 0) x = x.left '''else ''' '''if ''' cmp > 0) x = x.right '''return''' null
</code>
==Удаление==
<code>