Inserts a new value to tree and keeps it balanced
(self, a)
| 434 | return self.__nextSucc(new_node) |
| 435 | |
| 436 | def insertValue(self, a): |
| 437 | """ Inserts a new value to tree and keeps it balanced """ |
| 438 | if self.root is None: |
| 439 | self.root = Node(a) |
| 440 | elif a is not None: |
| 441 | node = self.findNode(a) |
| 442 | res = node.contains(a) |
| 443 | if res: return res |
| 444 | # try to insert a new value into existing node |
| 445 | node.insertValue(a) |
| 446 | self.__fixNodeInsert(node) |
| 447 | return self |
| 448 | |
| 449 | def insertList(self, xs): |
| 450 | """ Insert a list of values into a tree """ |
no test coverage detected