Algorithms Zig Zag Traversal of Binary Tree In this article, we present 4 different approaches for Zig Zag Traversal of Binary Tree using stack, deque, recursion and an iterative approach.
Algorithms Check if 2 Binary Trees are isomorphic Two Binary Trees are known as isomorphic if one of them can be obtained from the other one by series of flipping of nodes, swapping the children both left and right of number of nodes.
Algorithms Convert Binary Tree to Circular Doubly Linked list To convert binary tree to circular doubly linked list, we will take left node as previous pointer and right node as next pointer. The order of nodes in Doubly Linked List must be same as in inorder of the given binary tree.
Algorithms Succinct (0-1) Encoding of Binary Tree Succinct (0-1) Encoding of Binary Tree is an approach to encode a Binary Tree to the lowest possible space and maintain the structural information.
Algorithms LCA in Binary Tree using Euler tour and Range Minimum Query In this problem, we will find the Lowest Common Ancestor of a Binary Tree using Euler tour and Range Minimum Query. We can solve the LCA problem by reducing it to a RMQ problem.
Algorithms Lowest Common Ancestor in a Binary Tree In binary trees, for given two nodes a and b, the lowest common ancestor is the node of which both a and b are descendants. We explored the algorithm to find Lowest Common Ancestor in a Binary Tree.
Problems on Binary Tree Operations in Threaded Binary Tree There are three main operations which can be done on a threaded binary tree Insert, Search and Delete operation which we have explained in depth.
Problems on Binary Tree Threaded Binary Tree Threaded binary tree is a simple binary tree but they have a speciality that null pointers of leaf node of the binary tree is set to inorder predecessor or inorder successor.
Algorithms Boolean Parenthesization Problem We will solve Boolean Parenthesization Problem using Dynamic Programming and understand the algorithm with a step by step explanation. The time complexity to solve this problem is O(N^3) with a space complexity of O(N^2).
Problems on Binary Tree Checking if a Binary Tree is foldable A binary tree is foldable if the left subtree and right subtree are mirror images of each other. An empty tree is also foldable. We have presented two algorithms to check if Binary Tree is foldable.
Problems on Binary Tree Serialization and Deserialization of Binary Tree We have presented the process of Serialization and Deserialization of Binary Tree where we convert a Binary Tree into a compress form which can be saved in a file and retrieved back.
Problems on Binary Tree Convert a Binary Tree to a Skewed Binary Tree We have presented the algorithm to Change a Binary Tree to a Skewed Binary Tree (both Increasing Skewed Binary Tree and Decreasing Skewed Binary Tree).
Problems on Binary Tree Check if a Binary Tree is skewed or not We have presented the algorithm to check if a given Binary Tree is skewed or not (can be left or right skewed Binary Tree).
Algorithms Munchausen Number A number that is equal to the sum of its digits each raised to the power equal to its digit is a Munchausen Number or perfect digit-to-digit invariant(PDDI).
Problems on Binary Tree Find ancestors of a given node in a binary tree (Recursive + Iterative) Understand how to find ancestors of a given node in a binary tree recursively and iteratively in linear time O(N).
Problems on Binary Tree Find nodes which are at a distance k from root in a Binary Tree We are given the root of a tree, and an integer k. We need to print all the nodes which are a distance k from the root.
Problems on Binary Tree Find ancestors of a node in Binary tree (Recursive) In this problem, we are given a binary tree and a key k. We need to find out all the ancestors of node k. We have used a recursive approach.
Machine Learning (ML) SAME and VALID padding SAME and VALID padding are two common types of padding using in CNN (Convolution Neural Network) models. SAME padding is equal to kernel size while VALID padding is equal to 0.
Algorithms Finding nodes at distance K from a given node We have discussed the approach to find out the nodes at k distance from the given node. There are two approaches: one using Breadth First Traversal and other using Percolate Distance.
Problems on Binary Tree Check if a Binary Tree has duplicate values Given a Binary Tree, we will develop an algorithm to check if it has duplicate values. This can be done in linear time O(N) where there are N elements in the Binary Tree.
Algorithms Triplets with given Sum Given an array, we need to find if there is a triplet in the array whose sum is equal to a given value. If such a triplet is present, we need to print it and return true. Else, return false.
Algorithms Counting derangements Given any integer N, we need to find out the number of Derangements for a set of N elements.
Machine Learning (ML) How a ML Dataset is designed? In this article, we have explored How a (Machine Learning) ML Dataset is designed? with the example of the PASCAL dataset (Pascal-1 Visual Object Classes (VOC)) and how it evolved over the years and how the initial dataset was prepared.
Software Engineering footer tag in HTML The "footer" tag is normally used for defining the footer or end part of a section on html page. Each "footer" will have information about its containing element. The "footer" will have information about the article and the page author.
Software Engineering Defining 2D array in Python We have explored the different ways of defining a 2D array in Python. We have explored three approaches: Creating a List of Arrays, Creating a List of Lists and creating 2D array using numpy.