# Tree

­

## Tree

A tree is a data structure consisting of nodes organised as a hierarchy

November 14th, 2015|Categories: Tree|Tags: , |

## Binary Tree

A binary tree is a tree data structure in which each node has at most two children

November 14th, 2015|Categories: DS and Algorithms, Tree|Tags: , , |

## Binary Tree Traversal

Introduce the 3 types of Binary tree traversal - pre-order traversal, in-order traversal and post-order traversal.

November 14th, 2015|Categories: DS and Algorithms, Tree|Tags: , , |

## BST:Binary Search Tree

Introduce the concept of BST and the related algorithms

November 14th, 2015|Categories: DS and Algorithms, Tree|Tags: , , |

## Height Balanced Tree

A tree is height-balanced if the heights of the left and right subtree's of each node are within 1.

November 14th, 2015|Categories: DS and Algorithms, Tree|Tags: , , |

## Complete Tree and full Binary Tree

Introduce Complete Tree and Full Tree

November 14th, 2015|Categories: DS and Algorithms, Tree|Tags: , , |

## [Leetcode] Kth Smallest Element in a BST

Given a binary search tree, find the kth smallest element in it.

November 14th, 2015|Categories: DS and Algorithms, Tree||

## [Leetcode] Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.

November 14th, 2015|Categories: DS and Algorithms, Graph, Recursion, Tree||

## [Leetcode] Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.

November 14th, 2015|Categories: DS and Algorithms, Graph, Tree||

## [Leetcode] Sum Root to Leaf Numbers

Calculate the total sum of all root-to-leaf numbers.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree||

## [Leetcode] Invert Binary Tree

Invert a binary tree.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree||

## [Leetcode] Binary Tree Preorder Traversal

Given a binary tree, return the preorder traversal of its nodes’ values.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Stack, Tree||

## [Leetcode] Binary Tree Right Side View

Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree||

## [Leetcode] Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree||

## [Leetcode] Path Sum II

Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree||

## [Leetcode] Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.

November 14th, 2015|Categories: DS and Algorithms, Tree||

## [Leetcode] Same Tree

Given two binary trees, write a function to check if they are equal or not.

November 14th, 2015|Categories: DS and Algorithms, Tree||

## [Leetcode] Count Complete Tree Nodes

Given a complete binary tree, count the number of nodes.

November 14th, 2015|Categories: DS and Algorithms, Tree||

## [Leetcode] Symmetric Tree

Given a binary tree, check whether it is a mirror of itself.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree||

## [Leetcode] Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.

November 14th, 2015|Categories: DS and Algorithms, Tree||

## [Leetcode] Lowest Common Ancestor of a Binary Tree

Given a binary tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.

November 14th, 2015|Categories: DS and Algorithms, Tree||

## [Leetcode] Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST).

November 14th, 2015|Categories: DS and Algorithms, Tree||

## [Leetcode] Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree||

## [Leetcode] 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

November 16th, 2015|Categories: DS and Algorithms, Stack, Tree||

## [Leetcode] Unique Binary Search Trees

Given n, how many structurally unique BST's (binary search trees) that store values 1...n?

November 24th, 2015|Categories: DS and Algorithms, Dynamic Programming, Tree||

## [Leetcode] Implement Trie (Prefix Tree)

Implement a trie with insert, search, and startsWith methods.

December 1st, 2015|Categories: DS and Algorithms, Searching, Tree||

## [Leetcode] Add and Search Word – Data structure design

Design a data structure that supports add(word) and search(word).

December 1st, 2015|Categories: DS and Algorithms, Hash, Searching, Tree||

## [Leetcode] Balanced Binary Tree

Given a binary tree, determine if it is a height balanced binary tree.

December 8th, 2015|Categories: DS and Algorithms, Tree||