Created
November 11, 2017 10:56
-
-
Save iwouldnot/a4825ab40831c9c0e6a47fb3ad137a0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __case_6(self, node): | |
""" | |
Для кейса 6 нужно: | |
БРО должен быть ЧЕРНЫМ | |
ВЫХОДЯЩАЯ НОДА должна быть КРАСНОЙ | |
Затем, выполняется правая/левая ротация на бро | |
Ниже пример, когда направлеие бро - ЛЕВОЕ | |
Удвоенный черный | |
__50B__ | __35B__ | |
/ \ | / \ | |
БРОТАН --> 35B |80B| <- 30R 50R | |
/ \ / / \ / \ | |
30R 37B 70R Внешняя нода RED 20B 34B 37B 80B | |
/ \ Ближняя нода ни на что / | |
20B 34B не влияет 70R | |
Родитель ни на что | |
не влияет | |
Так что фигачим правую ротацию на 35B | |
""" | |
sibling, direction = self._get_sibling(node) | |
outer_node = sibling.left if direction == 'L' else sibling.right |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment