In this chapter, we shall see how to add all the nodes value. Problem Statement: Given a binary tree root node, return the sum of all the nodes of the tree. Example: Consider the tree below: The total sum will …
In this chapter, we shall see if 2 trees are identical. Problem statement: You are given root node of 2 binary trees, you need to check if 2 trees are identical. Example: Consider the below image The first set are identical; the …
In this chapter we shall solve how to find out diameter of a binary tree. Problem statement: You are given root node of a binary tree, you need to find the diameter in that tree. Now wait a minute, Diameter term is usually …
In this chapter we shall see tree spiral order traversal using 2 stacks. Problem statement: Given a root of the Binary tree, you need to print the nodes in a spiral order. Consider the tree as below: The zigzag order will be …
In this chapter we shall calculate the height of a Binary Tree. Problem Statement: Given the root node of binary tree, calculate the height of that tree. Example: Consider the tree below: The height of the binary tree will be 4. The …
In this tutorial we shall see how to do vertical order traversal. Problem Statement: You are given a root node of a tree, you need to print the nodes when they are traversed vertically. Consider the tree given below: The vertical order traversal …
In this tutorial we shall see how to print level by level of the tree nodes. Problem Statement: Given the root node of the tree, print the nodes level by level. For example: Consider the tree below: Here the level order traversal …