Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
/**
* Definition for binary tree
...
分类:
其他好文 时间:
2014-12-15 21:52:22
阅读次数:
124
一.问题描述 :
014-12-15 20:00:29 4398 [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more t
Last_SQL_Errno: 1666
Last_SQL_Error: Erro...
分类:
其他好文 时间:
2014-12-15 21:47:48
阅读次数:
216
Binary Tree Level Order TraversalGiven a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).Fo...
分类:
其他好文 时间:
2014-12-15 18:59:13
阅读次数:
148
1.快速统计行数(ctrl+Shift+(方向键向下))。bson数据类型留个影响public enum BsonType { Double = 0x01, String = 0x02, Document = 0x03, Array = 0x04, Binary = 0...
分类:
其他好文 时间:
2014-12-15 17:03:15
阅读次数:
178
二叉树的遍历方式基本就是前序遍历,中序遍历,后序遍历和层次遍历。从代码的角度来说,前三种最简单的就是用递归了,代码会非常简洁。但是递归有一个缺陷,就是当二叉树的节点非常多的时候,层次深的递归会不停的进行程序的压栈和出栈操作,效率比较低。这里就不写递归算法了,只写四种遍历的非递归算法。
先定义二叉树的节点如下:
/**
* Definition for binary tree
* pub...
分类:
编程语言 时间:
2014-12-15 13:47:08
阅读次数:
305
Tree
时间限制:1000 ms | 内存限制:65535 KB
难度:3
描述Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with
capital lett...
分类:
其他好文 时间:
2014-12-15 09:04:48
阅读次数:
157
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41929059
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
...
分类:
其他好文 时间:
2014-12-15 09:04:30
阅读次数:
137
题目:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. ...
分类:
其他好文 时间:
2014-12-14 18:30:16
阅读次数:
176
终于完成了LeetCode 上AC率在30%以上的题目,这道题是最后一道,纪念一下。
原题是这个样子的:
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent
a number.
An example is the root-to-leaf...
分类:
其他好文 时间:
2014-12-14 00:49:21
阅读次数:
157
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:
其他好文 时间:
2014-12-14 00:43:17
阅读次数:
170