Skip to content

Latest commit

 

History

History
25 lines (14 loc) · 671 Bytes

File metadata and controls

25 lines (14 loc) · 671 Bytes

Code Challenge 32 : Find common values in 2 binary trees

Challenge Description

Given two binary trees, return a set of values found in both trees.

Approach & Efficiency

Iterate over the first tree using a preOrder method to add tree values into a Hashtable.
Traverse the second tree checking to see if values are present in the hashMap. If it is, add to result array.

Space : O(n)
Time: O(n)

Solution

UML