Symmetric Tree?
Check if given tree is symmetrical
Solution: Bottom up recursion
Base Case:
Both null return true
One null return false
Left key != right key return false
Implementation:
Time Comp: O(N) Every node visited
Space Comp: O(Height) max stack size
Last updated
Was this helpful?