744
2 Likes

DSA Crash Course [Part 45] - Tree Includes Approach

In this lesson, Alvin explores the strategy to solving the following interview problem:

Write a function, tree_includes, that takes in the root of a binary tree and a target value. The function should return a boolean indicating whether or not the value is contained in the tree.

a = Node("a")
b = Node("b")
c = Node("c")
d = Node("d")
e = Node("e")
f = Node("f")
a.left = b
a.right = c
b.l