mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-06 17:38:02 +00:00
Polish bst challenge and solution
Add root is None input test case. Update time and space complexity discussion.
This commit is contained in:
@@ -11,6 +11,9 @@ class Node(object):
|
||||
|
||||
|
||||
def insert(root, data):
|
||||
if root is None:
|
||||
root = Node(data)
|
||||
return root
|
||||
if data <= root.data:
|
||||
if root.left is None:
|
||||
root.left = Node(data)
|
||||
|
||||
Reference in New Issue
Block a user