Skip to content
MasterInKotlin

MasterInKotlin

  • Home
  • KotlinAI
  • About Us!
  • Contact Us
  • Privacy Policy

To Check if Binary Tree is Balanced in Kotlin

17 February 202416 February 2024 by masterinkotlin.com

To check if a binary tree is balanced or not, we can use a recursive approach. A binary tree is considered balanced if the difference between the height of its left and right subtrees is no more than one, and both the left and right subtrees are also balanced. Here’s an algorithm to check whether … Read more

Categories Binary Tree, Blog Leave a comment

Zig Zag Traversal of Binary Tree in Kotlin | Snack Traversal

17 February 202416 February 2024 by masterinkotlin.com

Zigzag traversal of a binary tree is a way of visiting the nodes of the tree in a zigzag pattern. It means that we first visit the nodes at level 1 from left to right, then the nodes at level 2 from right to left, and so on. Essentially, we alternate between left-to-right and right-to-left … Read more

Categories Binary Tree, Blog Leave a comment

Power Set using Bit Manipulation in Kotlin

17 February 202416 February 2024 by masterinkotlin.com

In set theory, the power set (or the “set of all subsets”) of a given set is defined as the set of all possible subsets of that set, including the empty set and the set itself. For example, if we have a set A = {1, 2}, the power set of A would be: P(A) … Read more

Categories Blog, Set theory Leave a comment

Bottom View of Binary Tree in Kotlin

17 February 202416 February 2024 by masterinkotlin.com

The bottom view of a binary tree is the set of nodes that are visible when the tree is viewed from the bottom. In other words, it is the set of nodes that are at the bottom-most level of the tree for each horizontal distance. If there are multiple nodes at the same horizontal distance … Read more

Categories Binary Tree, Blog Leave a comment

Top View of Binary Tree in Kotlin

17 February 202416 February 2024 by masterinkotlin.com

The top view of a binary tree is the set of nodes that are visible when we look at the tree from the top. To be more precise, the top view of a binary tree is the set of nodes that are visible when we project the tree onto a vertical plane and look at … Read more

Categories Binary Tree, Blog Leave a comment

Right view of Binary Tree in Kotlin

17 February 202416 February 2024 by masterinkotlin.com

The right view of a binary tree is a list of nodes that are visible when the tree is viewed from the right side. In other words, it is a list of the last node in each level of the tree when viewed from the right. Here’s an example binary tree: The right view of … Read more

Categories Binary Tree, Blog Leave a comment

Left View of Binary Tree in Kotlin

17 February 202416 February 2024 by masterinkotlin.com

he left view of a binary tree is the set of nodes that are visible when the tree is viewed from the left side. In other words, it is the first node encountered at each level of the tree when traversing the tree from left to right. For example, consider the following binary tree: The … Read more

Categories Binary Tree, Blog Leave a comment

Mirror of a Binary tree in Kotlin

17 February 202416 February 2024 by masterinkotlin.com

A mirror of a binary tree is a tree that is obtained by swapping the left and right subtrees of each node in the original tree. In other words, the mirror image of a binary tree is the reflection of the tree along its vertical axis. For example, consider the following binary tree: The mirror … Read more

Categories Binary Tree, Blog Leave a comment

Diameter of a Binary Tree in Kotlin

17 February 202416 February 2024 by masterinkotlin.com

The diameter of a binary tree is defined as the length of the longest path between any two nodes in the tree. This path may or may not pass through the root node. To calculate the diameter of a binary tree, we first find the heights of the left and right subtrees of each node. … Read more

Categories Binary Tree, Blog Leave a comment

Count Number of bit from 1 to n in Kotlin

17 February 202416 February 2024 by masterinkotlin.com

To calculate the total number of bits from 1 to n, we can iterate over all the numbers from 1 to n and count the number of bits in each number. We can use the Integer.bitCount() method in Java or the countOneBits() method in Kotlin to count the number of bits in each number. Then, … Read more

Categories Blog, Set theory Leave a comment
Older posts
Newer posts
← Previous Page1 … Page9 Page10 Page11 … Page18 Next →

Recent Posts

  • Matrix Diagonal Difference using Kotlin
  • Cycle Detection in Linked Lists
  • Cisco Packet Tracker Computer Network
  • 0/1 knapsack problem recursive
  • 0/1 Knapsack using DP
© 2025 MasterInKotlin • Built with GeneratePress