(t_node, c1, c2)
| 289 | # It return value in the lowest common ancestor, -1 indicates value returned for None. |
| 290 | # Note that both values v1 and v2 should be present in the bst. |
| 291 | def lca(t_node, c1, c2): |
| 292 | if c1 == c2: |
| 293 | return c1 |
| 294 | current = t_node |
| 295 | while current: |
| 296 | if c1 < current.info and c2 < current.info: |
| 297 | current = current.left |
| 298 | elif c1 > current.info and c2 > current.info: |
| 299 | current = current.right |
| 300 | else: |
| 301 | return current.info |
| 302 | return -1 |
| 303 | |
| 304 | |
| 305 | # Function to print element vertically which lie just below the root node |
nothing calls this directly
no outgoing calls
no test coverage detected