Complete the code to insert a value into a BST node.
if root is None: root = [1](key) else: # Insert recursively
We create a new Node instance to insert into the BST when the root is None.
Complete the code to check if a key exists in a hash map.
if [1] in hashmap: print('Found') else: print('Not found')
We check if the key exists in the hash map using the in keyword.
Fix the error in the BST search function by completing the blank.
def search(root, key): if root is None or root.key == key: return root if key < [1].key: return search(root.left, key) else: return search(root.right, key)
node or value.The comparison should be with root.key to decide the search path in the BST.
Fill both blanks to create a dictionary comprehension that filters keys greater than 10.
{k: v for k, v in data.items() if k [1] 10 and v [2] 0}The comprehension keeps items where the key is greater than 10 and the value is not zero.
Fill all three blanks to create a BST insertion function snippet.
if root is None: return [1](key) if key [2] root.key: root.left = insert(root.left, key) else: root.right = insert(root.right, key) return [3]
We create a new Node if root is None, compare key with root.key using <, and finally return the root node.
