# | Time Complexity | Space Complexity | Description | Submission | Runtime (4 trials) | Memory (4 trials) |
---|---|---|---|---|---|---|
1 | O(n) | O(n) | Generate arrays of value for both tree using Breadth-First Search (BFS), then compare the two arrays to determine the equalness | Submission | 37.5ms | 16.6 MB |
2 | O(n) | O(n) | Use recursive function to compare the two trees by compare the subtrees | Submission | 31.25ms | 16.55 MB |