binary tree

/Tag:binary tree
­

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|Tags: , , , , , |

[Leetcode] Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.

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

[Leetcode] Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.

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

[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|Tags: , , , , , |

[Leetcode] Invert Binary Tree

Invert a binary tree.

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

[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|Tags: , , , , , |

[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|Tags: , , , , , |

[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|Tags: , , , , , |

[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|Tags: , , , , , |

[Leetcode] Binary Tree Paths

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

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

[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|Tags: , , , , , |

[Leetcode] Symmetric Tree

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

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

[Leetcode] Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values. (Both recursive and iterative solutions)

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

[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|Tags: , , , , , |

[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|Tags: , , , , |

[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|Tags: , , , , , |

[Leetcode] Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.

[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.

[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|Tags: , , , , , |