A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possibl ...
分类:
其他好文 时间:
2018-10-25 10:55:18
阅读次数:
161
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all ...
分类:
其他好文 时间:
2018-10-25 00:36:33
阅读次数:
226
二分查找(Binary Search)的思想非常简单,但看似越简单的东西往往越难掌握好,想要灵活运用就更加困难。 1. 二分查找的思想? 生活中二分查找的思想无处不在。一个最常见的就是猜数游戏,我随机写一个 0 到 99 的数,然后你来猜我写的是什么。猜的过程中,我会告诉你每次是猜大了还是猜小了,直 ...
分类:
编程语言 时间:
2018-10-25 00:25:20
阅读次数:
179
Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Exa ...
分类:
其他好文 时间:
2018-10-25 00:18:47
阅读次数:
205
题目为 解题思路: 题设要求判断形如101010的数字,那么如何在复杂度最小的情况下给出算法呢 首先看一下用python解决本题有哪些基本工具。 说到二进制,首先想到的是位运算符号,python的位运算符号有& ^ ~ | >> <<这六种。 先看移位,易发现如果将101010右移一位,则有1010 ...
分类:
其他好文 时间:
2018-10-24 20:12:17
阅读次数:
119
二叉树的遍历(traversing binary tree)是指从根结点出发,按照某种次序依次访问二叉树中所有的结点,使得每个结点被访问依次且仅被访问一次。 四种遍历方式分别为:先序遍历、中序遍历、后序遍历、层序遍历。 一、先序遍历 1. 访问根节点 2. 用先序遍历的方式访问左子树 3. 用先序遍 ...
分类:
其他好文 时间:
2018-10-24 15:32:22
阅读次数:
141
1 //可以任意节点开始left+right 所以dfs的时候要每个节点都计算一下 2 class Solution { 3 int max = Integer.MIN_VALUE; 4 public int diameterOfBinaryTree(TreeNode root) { 5 if(ro... ...
分类:
其他好文 时间:
2018-10-24 10:56:53
阅读次数:
148
1 //New 2 class Solution { 3 public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { 4 if(root == null) return null; 5 if(root.v... ...
分类:
其他好文 时间:
2018-10-24 10:43:58
阅读次数:
145
最近在调试网站时发现,通过ftp上传工具FileZilla上传至服务器端的文件与本地文件大小不一致,虽然没有影响网站的最终显示效果,但仍让我困惑不解。后发现是传输类型的原因,解决方法如下: 中文版FileZilla菜单栏->传输->传输类型->二进制(Binary) 造成大小不一致的原因:ASCII ...
分类:
Web程序 时间:
2018-10-23 20:46:16
阅读次数:
462
从官网下载 Binary Distributions 版本的相应的压缩包, 解压后,放到想要的目录即可。 启动和关闭Tomcat服务器 进入tomcat目录下的bin目录,执行 ./startup.sh 或 ./shutdown.sh Tomcat服务器启动后,通过内网的另一台机器进行访问,其中19 ...
分类:
系统相关 时间:
2018-10-22 14:40:26
阅读次数:
241