码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
leetcode - 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-01-07 16:21:35    阅读次数:143
十进制转二进制和十六进制
classTestL { publicstaticvoidmain(String[]args) { inti=60; Stringbinary=Integer.toBinaryString(i); System.out.println(binary); Stringhex=Integer.toHexString(i); System.out.println(hex); intj=i&15; Stringk1=(i<=9)?j+"":(char)(j-10+..
分类:其他好文   时间:2015-01-07 15:09:56    阅读次数:130
LeetCode: Recover Binary Search Tree 解题报告
Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A sol...
分类:其他好文   时间:2015-01-07 14:40:01    阅读次数:173
C# 序列化理解 2(转)
一、概述序列化是把对象转变成流。相反的过程就是反序列化。哪些场合用到这项技术呢?1. 把对象保存到本地,下次运行程序时恢复这个对象。2. 把对象传送到网络的另一台终端上,然后在此终端还原这个对象。3. 复制系统的粘帖板中,然后用快捷键Ctrl+V恢复这个对象。常用的序列化流有Binary(二进制流)...
分类:Windows程序   时间:2015-01-07 10:49:37    阅读次数:291
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. 题意很简单:根据中序遍历和后序遍历的序列生成树 思路很简单:根据后序遍历的序列确定根节点,在中序遍历中找到根节点,将原来的序列分为左右两个部分,递归解决左右两个部分就可以解决这个问题。 Java代码如下: publ...
分类:其他好文   时间:2015-01-07 01:52:25    阅读次数:160
BZOJ 3831: [Poi2014]Little Bird【动态规划】
DescriptionIn the Byteotian Line Forest there are trees in a row. On top of the first one, there is a little bird who would like to fly over to the t....
分类:其他好文   时间:2015-01-06 21:22:07    阅读次数:278
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. Calling next() will return the next smallest number in the BST. Note: next()...
分类:其他好文   时间:2015-01-06 20:09:24    阅读次数:159
Gray Code(格雷码)
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total numb...
分类:其他好文   时间:2015-01-06 19:55:57    阅读次数:159
[LeetCode]114 Flatten Binary Tree to Linked List
https://oj.leetcode.com/problems/flatten-binary-tree-to-linked-list/http://blog.csdn.net/linhuanmars/article/details/23717703/** *Definitionforbinarytree *publicclassTreeNode{ *intval; *TreeNodeleft; *TreeNoderight; *TreeNode(intx){val=x;} *} */ publicclass..
分类:其他好文   时间:2015-01-06 18:20:38    阅读次数:147
[LeetCode]121 Best Time to Buy and Sell Stock
https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/http://blog.csdn.net/linhuanmars/article/details/23162793publicclassSolution{ publicintmaxProfit(int[]prices) { //SolutionA: returnmaxProfit_DP(prices); //SolutionB: //returnmaxProfit_Binary(..
分类:其他好文   时间:2015-01-06 18:11:55    阅读次数:176
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!