Test If A Binary Tree Is Symmetric ("Symmetric Tree" on Leetcode)

Code - Free 5-Day Mini-Course: Try Our Full Platform: 📹 Intuitive Video Explanations 🏃 Run Code As You Learn 💾 Save Progress ❓New Unseen Questions 🔎 Get All Solutions Question: Write a program to check if a binary tree is symmetric in structure as well as value. A binary tree is symmetric if we can draw a vertical line down from the root and the left and right subtrees are mirrors of each other in structure and value. The least this could be is O(n) time because we have to inspect all n nodes values to ensure that they conform to the tree being symmetric. All we need to do is traverse the tree correctly with our recursion checking pairs for conformity. The Conditions If the root is null, the tree is symmetric. Our checking function will take 2
Back to Top