码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
144. Binary Tree Preorder Traversal (Tree, Stack)
Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3...
分类:其他好文   时间:2015-10-03 18:17:43    阅读次数:161
114. Flatten Binary Tree to Linked List (Stack, Tree; DFS)
Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened ...
分类:其他好文   时间:2015-10-03 18:17:01    阅读次数:176
leetcode 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-10-03 18:16:44    阅读次数:200
145. Binary Tree Postorder Traversal (Stack, Tree)
Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,...
分类:其他好文   时间:2015-10-03 18:13:25    阅读次数:214
109. Convert Sorted List to Binary Search Tree (List; Divide-and-Conquer, dfs)
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.struct ListNode { int val; ListNode *...
分类:其他好文   时间:2015-10-03 15:30:38    阅读次数:152
108.Convert Sorted Array to Binary Search Tree(Array; Divide-and-Conquer, dfs)
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路:使用二分法,将list的中间节点作为根节点,然后分别处理list左半边及右半边,以此递归。struc...
分类:其他好文   时间:2015-10-03 14:24:21    阅读次数:162
[LeetCode] 116 - Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe...
分类:其他好文   时间:2015-10-03 11:53:52    阅读次数:134
[LeetCode] 94 - Binary Tree Inorder Traversal
Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note...
分类:其他好文   时间:2015-10-03 11:50:06    阅读次数:131
LeetCode:Path Sum - 树的根节点到叶节点的数字之和
1、题目名称 Path Sum(树的根节点到叶节点的数字之和) 2、题目地址 https://leetcode.com/problems/path-sum/ 3、题目内容 英文:Given a binary tree and a sum, determine if the tree has a root-to-leaf p...
分类:其他好文   时间:2015-10-02 00:20:20    阅读次数:316
hdu 5491 The Next(暴力枚举)
Problem DescriptionLet L denote the number of 1s in integer D’s binary representation. Given two integers S1 and S2, we call D a WYH number if S1≤L≤S2...
分类:其他好文   时间:2015-10-01 19:07:20    阅读次数:142
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!