码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
【Leetcode】【Medium】Binary Tree Zigzag Level Order Traversal
Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al...
分类:其他好文   时间:2015-05-21 10:28:55    阅读次数:159
LeetCode 105 106:Construct Binary Tree from Preorder/Postorder and Inorder Traversal
LeetCode 105: Given preorder and inorder traversal of a tree, construct the binary tree. 给定一个二叉树的前序和中序遍历,重建这棵二叉树。 LeetCode 106: Given inorder and postorder traversal of a tree, constru...
分类:其他好文   时间:2015-05-21 09:12:32    阅读次数:207
144 Binary Tree Preorder Travesal
递归public class Solution { public ArrayList preorderTraversal(TreeNode root) { ArrayList res = new ArrayList(); traversal(root, res); ...
分类:其他好文   时间:2015-05-21 07:51:52    阅读次数:113
Red-Black Tree
http://pages.cs.wisc.edu/~skrentny/cs367-common/readings/Red-Black-Trees/http://en.wikipedia.org/wiki/Red–black_tree1.Every node is either red or blac...
分类:其他好文   时间:2015-05-21 07:50:59    阅读次数:100
HackerRank - "Triplets"
Good one to learn Binary Indexed Tree (Fenwick Tree). Simply grabbed the editorial's code but with comments.#include #include #include #include #inclu...
分类:其他好文   时间:2015-05-21 07:50:44    阅读次数:114
【Leetcode】【Medium】Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.解题思路:给出一个二叉树的中...
分类:其他好文   时间:2015-05-21 06:40:31    阅读次数:121
【Leetcode】【Medium】Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.解题思路:给出一个二叉树的先序...
分类:其他好文   时间:2015-05-21 06:37:42    阅读次数:96
【Leetcode】【Medium】Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.解题思路:用一个有序数组,创建一个平衡二叉查找树。为确保平衡,需要满足两子树的高度差不大于1,可以通过设置...
分类:其他好文   时间:2015-05-21 06:37:05    阅读次数:123
【Leetcode】【Medium】Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:其他好文   时间:2015-05-21 06:36:41    阅读次数:103
LeetCode Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node. ...
分类:其他好文   时间:2015-05-21 00:05:17    阅读次数:181
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!