Home Data Structure

# Data Structure

Algorithm

### Algorithm Books

Programmer - 0

An algorithm is a formula for solving a problem, based on conducting a sequence of specified actions. In computer science, an algorithm usually means a...

Data Structure

### Merge Two Binary Trees

Programmer - 0

In this article, we learn how to Merge Two Binary Trees with example and two different approaches. First approach is In Java using recursion (By creating...

Data Structure

### Invert Binary Tree

Programmer - 0

A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right...

Data Structure

### Check Same Binary Tree

Programmer - 0

Check Same Binary Tree
Question: Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if...

Data Structure

### Average of Levels in Binary Tree

Programmer - 0

Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.
Example 1:
Input:
...

Data Structure

### Convert BST to Greater Tree

Programmer - 0

Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the...

Data Structure

### Symmetric Tree

Programmer - 0

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
...

Data Structure

### Binary Tree Path Sum III

Programmer - 0

You are given a binary tree in which each node contains an integer value.
Find the number of paths that sum to a given value.
The...

Data Structure

### Binary Tree Path Sum II

Programmer - 0

Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree...