码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
LeetCode – Refresh – Convert Sorted List to Binary Search Tree
Similar to the sorted array. But we have to remember, the position of node not depends on the index. So we need do two more things:1. Ensure the point...
分类:其他好文   时间:2015-03-19 06:20:30    阅读次数:132
LeetCode – Refresh – Construct Binary Tree from Inorder and Preorder Traversal
Only different with preorder and postorder is that the root start from the beginning for preorder. 1 /** 2 * Definition for binary tree 3 * struct T.....
分类:其他好文   时间:2015-03-19 06:20:26    阅读次数:122
Number of 1 Bits (求32位二进制数中1的)
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit integer ’11' has binary representation 00000000000000000000000000001011, so the function should return...
分类:其他好文   时间:2015-03-18 18:06:47    阅读次数:92
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.Fo...
分类:其他好文   时间:2015-03-18 15:20:00    阅读次数:131
二叉树的非递归遍历(先序, 中序, 后序)
先序遍历:/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), ...
分类:其他好文   时间:2015-03-18 13:48:17    阅读次数:124
(hdu step 7.1.5)Maple trees(求凸包的最小覆盖圆的半径)
题目:Maple treesTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 177 Accepted Submission(s): 63 Problem DescriptionThere are a lot of trees in HDU. Ki...
分类:其他好文   时间:2015-03-18 12:21:11    阅读次数:222
LeetCode – Refresh – Binary Tree Zigzag Level Order Traversal
Made a stupid bug....... When reverse the vector, stop it at mid. Otherwise, it will swap back......Mark!!!!!!!! 1 /** 2 * Definition for binary tree....
分类:其他好文   时间:2015-03-18 10:23:29    阅读次数:120
LeetCode – Refresh – Binary Tree Upside Down
Recursive method can be unstand easily:1. Assume we get the sub node with this transition. So we need to make the current node.2. As the symmetic, the...
分类:其他好文   时间:2015-03-18 10:12:06    阅读次数:128
LeetCode – Refresh – Binary Tree Level Order Traversal
Basic question. Use a queue to store Node, use two numbers to record current level node numbers and next level node numbers. 1 /** 2 * Definition for....
分类:其他好文   时间:2015-03-18 08:58:27    阅读次数:105
LeetCode – Refresh – Binary Tree Post Order Traversal
Still 3 methods:Same with inorder, but post order is a little different. We need to treat it as reverse result of preorder.So we go to right branch fi...
分类:其他好文   时间:2015-03-18 08:57:58    阅读次数:132
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!