题目描述 输入一棵二叉树,求该树的深度。从根结点到叶结点依次经过的结点(含根、叶结点)形成树的一条路径,最长路径的长度为树的深度。 题目链接: https://www.nowcoder.com/practice/435fb86331474282a3499955f0a41e8b?tpId=13&tqI ...
分类:
其他好文 时间:
2020-06-09 09:34:55
阅读次数:
74
前序遍历NLR:前序遍历(PreorderTraversal)又叫先序遍历。遍历顺序为:根节点—>左子树—>右子树,所以上图前序遍历的结果为ABDECFG代码实现:publicvoidprevOrder(TreeNoderoot){//递归方式if(root==null){return;}System.out.print(root.val);prevOrder(root.left);p
分类:
其他好文 时间:
2020-06-09 09:34:36
阅读次数:
55
#### 1. 浏览器渲染机制 - 浏览器采用流式布局模型(`Flow Based Layout`) - 浏览器会把`HTML`解析成`DOM Tree`,解析`css`构建`render`树(将css代码解析成树形的数据结构,然后结合DOM合并成render树) - 有了`RenderTree`, ...
分类:
其他好文 时间:
2020-06-08 16:10:30
阅读次数:
73
思路:递归。 终止条件是两个节点都为空,return True; 或者两个节点中有一个为空,return False; 或者两个节点的值不相等,return False; class Solution(object): def isSymmetric(self, root): """ :type r ...
分类:
其他好文 时间:
2020-06-08 15:02:40
阅读次数:
49
For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees. A binary tree X is flip e ...
分类:
其他好文 时间:
2020-06-08 00:23:38
阅读次数:
49
Given a binary tree, return the sum of values of nodes with even-valued grandparent. (A grandparent of a node is the parent of its parent, if it exist ...
分类:
其他好文 时间:
2020-06-08 00:15:28
阅读次数:
76
linear regression logistic regression SVM binary Tree naive bayes adaboost clustering ...
分类:
其他好文 时间:
2020-06-07 21:24:49
阅读次数:
59
题目描述 题解 LCT复习 把颜色挂在边上,给点1建一个父亲,对每一种颜色维护森林,每棵树的根不是该颜色,维护虚边的答案和 询问的话直接找一棵树的根,然后makeroot+access即可得到答案 需要维护子树+虚边size,直接相连的虚边size以及虚边的答案 每次修改就先把原来的答案减掉再加新的 ...
分类:
其他好文 时间:
2020-06-07 16:39:49
阅读次数:
81
##1.1 Nosql入门和概述 ###1.1.1 为什么要使用Nosql? 首先在SQL下当今最流行的Mysql也会有出现瓶颈的时候。一个网站的访问量一般都不大,而且更多的是静态页面,动态交互类型的网站不多,用单个数据库完全可以轻松应对。但是数据量的总大小一个机器放不下时,数据的索引(B+Tree ...
分类:
其他好文 时间:
2020-06-07 14:27:01
阅读次数:
62
第三阶段学习总结 在学习和开发ASP.NET Core Web应用程序过程中遇到的问题 在vs for mac中找不到mvc项目 通过更新解决 通过(https://www.cnblogs.com/wangjinya/p/10619149.html)了解了mvc模式和各个文件夹的作用 在将Eleme ...
分类:
其他好文 时间:
2020-06-07 13:11:07
阅读次数:
63