求二叉树的最大深度,是常见的一种二叉树算法问题,主要解决办法有两种,一种是使用递归求解,另一种是非递归方式求解。这里给出递归求解方法。递归方法无需判断左右子树是否为空。 问题来源于https://leetcode.com/problems/maximum-depth-of-binary-tree/d ...
分类:
其他好文 时间:
2018-06-02 19:35:32
阅读次数:
179
Node.js的开发非常活跃,它的最新稳定版本也频繁变化,你不时会发现,一个模块不能在你当前的Node版本上使用,此时你需要升级Node 幸运的是,可以用一种非常简单的方法来管理你的Node版本,即使用 。 1. 检查 Node的当前版本,使用命令 2. 清除npm cache 3. 安装n模块 4 ...
分类:
其他好文 时间:
2018-06-02 15:49:25
阅读次数:
188
Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL ...
分类:
其他好文 时间:
2018-06-02 11:24:49
阅读次数:
130
ACCESSIBLE,ADD,ALL,ALTER,ANALYZE,AND,AS,ASC,ASENSITIVE,BEFORE,BETWEEN,BIGINT,BINARY,BLOB,BOTH,BY,CALL,CASCADE,CASE,CHANGE,CHAR,CHARACTER,CHECK,COLLATE ...
分类:
数据库 时间:
2018-06-01 10:52:11
阅读次数:
332
github: "代码实现" 本文算法均使用python3实现 1. 二叉搜索树定义 二叉搜索树(Binary Search Tree),又名二叉排序树(Binary Sort Tree)。 二叉搜索树是具有有以下性质的二叉树: &emsp ...
分类:
编程语言 时间:
2018-05-31 20:29:30
阅读次数:
291
144. Binary Tree Preorder Traversal 题目:对一棵二叉树进行前序遍历,并将结果存在一个List 当中 思路:使用递归 细节: 对于递归版本:注意preorderTraversal() function 返回的是一个List, 所以不正直接用 res.add(root ...
分类:
其他好文 时间:
2018-05-31 10:38:51
阅读次数:
124
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes ...
分类:
其他好文 时间:
2018-05-30 10:50:40
阅读次数:
129
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), r... ...
分类:
其他好文 时间:
2018-05-30 00:30:02
阅读次数:
129
Description Description Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root no ...
分类:
编程语言 时间:
2018-05-29 11:56:35
阅读次数:
222
Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. Example 1 ...
分类:
其他好文 时间:
2018-05-28 22:43:42
阅读次数:
177