tree traversal

/Tag:tree traversal
­

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

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

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

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