Tag: binary

Binary Tree in Java – 6: Get number of Leaf Nodes in Binary Tree

Source Code: In this video, we’re going to reveal exact steps to Get Number of leaf Nodes in a Binary Tree in Java This problem is similar to following: binary tree Get Number of leaf Nodes Java, get number of leaf nodes in binary tree, get number of leaf nodes in binary tree in java, […]

Binary Tree in Java – 31: Print elements between any two given level of Binary Tree

Source Code: Solution: – We’ll take one queue & take level & size variable – Add element in queue from root node & keep on adding left & right in queue – When size is zero for a level, we’ll increase level – If level is within range, print element, Time Complexity: O(n) Space Complexity: […]

Binary Tree in Java – 9: Print elements in Level order (Using Recursion)

Source Code: In this video, we’re going to reveal exact steps to Print elements in level order using recursion in Binary Tree in Java Please check video for more info: CHECK OUT CODING SIMPLIFIED ★☆★ VIEW THE BLOG POST: ★☆★ I started my YouTube channel, Coding Simplified, during Dec of 2015. Since then, I’ve published […]

Binary Tree in Java – 29: Search an element in Binary Tree

Source Code: Solution: – We can search in recusive way using preorder traversal manner Time Complexity: O(n) Space Complexity: O(1) – We can another iterative approach like Level order traversal, where whenever we’re removing element from queue, we’re checking if element is equal to given element Time Complexity: O(n) Space Complexity: O(n) Do Watch video […]