Skip to main content

52 docs tagged with "Tree"

View all tags

Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.

Binary Tree Level Order Traversal II

Given the root of a binary tree, return the bottom-up level order traversal of its nodes' values. (i.e., from left to right, level by level from leaf to root).

Binary Tree Zigzag Level Order Traversal

Given a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right, then right to left for the next level and alternate between).

Construct String from Binary Tree

Given the root of a binary tree, construct a string consisting of parenthesis and integers from a binary tree with the preorder traversal way.

Convert BST to Greater Tree

Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST.

Counting Visible Nodes in Binary Tree

Given a binary tree, count the number of visible nodes. A node is considered visible if, in the path from the root to that node, there are no nodes with a greater value.

Even Odd Tree (LeetCode)

Determine if a binary tree is an "even-odd" tree, where the level of nodes alternates between odd and even values.

Height of Binary Tree Problem (gfg)

This tutorial covers the solution to the Height of Binary Tree problem from the GeeksforGeeks website, featuring implementations in Python and C++.

K Distance From Root

A solution to the problem of finding all the nodes which are at a distance k from the root

Merge Two Binary Trees

Given two binary trees, merge them into a new binary tree by adding the values of overlapping nodes.

Most Frequent Subtree Sum

Given the root of a binary tree, return the most frequent subtree sum. If there is a tie, return all the values with the highest frequency in any order.

My Calendar I

This is a solution to the My Calendar I problem on LeetCode.

Path Sum

Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum.

Path Sum III

This is a solution to the Path Sum III problem on LeetCode.

Path Sum-II

Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values in the path equals targetSum. Each path should be returned as a list of the node values, not node references.

Subtree of Another Tree(LeetCode)

Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise.

Sum root to leaf numbers

You are given the root of a binary tree containing digits from 0 to 9 only.Each root-to-leaf path in the tree represents a number.