Insert a new node containing *value* into this tree such that its structure as a binary search tree is preserved.
(self, value)
| 154 | return bst |
| 155 | |
| 156 | def insert(self, value): |
| 157 | """ |
| 158 | Insert a new node containing *value* into this tree such that its |
| 159 | structure as a binary search tree is preserved. |
| 160 | """ |
| 161 | side = "_lesser" if value < self.value else "_greater" |
| 162 | child = getattr(self, side) |
| 163 | if child is None: |
| 164 | setattr(self, side, _BinarySearchTree(value)) |
| 165 | else: |
| 166 | child.insert(value) |
| 167 | |
| 168 | def tree(self, level=0, prefix=""): |
| 169 | """ |
no test coverage detected