题目描述: 给你一个二叉树,请你返回其按 层序遍历 得到的节点值。 (即逐层地,从左到右访问所有节点)。 返回其层次遍历结果: 示例:二叉树:[3,9,20,null,null,15,7], 思想: 访问过程中,只需要将同一层中的节点同时入队列即可。在将该queue中所有元素出队列的同时,将下一层的 ...
分类:
其他好文 时间:
2020-04-18 15:44:30
阅读次数:
63
前言 根据插入序列建立二叉平衡树并输出根结点,其实就是考察能否掌握建立二叉平衡树的过程。这题去年有写过,但是一直卡住了,这次终于写出来了,而且真的见识到了一些很 精妙 的操作,不管是调整还是插入过程。 题目描述 An AVL tree is a self balancing binary searc ...
分类:
其他好文 时间:
2020-04-18 13:41:24
阅读次数:
78
登录系统后,在当前命令窗口下输入命令: ls / 你会看到如下图所示: 树状目录结构: 以下是对这些目录的解释: /bin: bin是Binary的缩写, 这个目录存放着最经常使用的命令。 /boot:这里存放的是启动Linux时使用的一些核心文件,包括一些连接文件以及镜像文件。 /dev :dev ...
分类:
系统相关 时间:
2020-04-18 09:20:50
阅读次数:
61
CAP理论 Consistency,一致性 是指所有节点在同一时刻的数据是相同的,即更新操作执行结束并响应用户完成后,所有节点存储的数据会保持相同。 Availability,可用性 是指系统提供的服务一直处于可用状态,对于用户的请求可即时响应。 Partition Tolerance,分区容错性 ...
分类:
其他好文 时间:
2020-04-17 16:09:39
阅读次数:
110
该项目的目的是建立一个有关于人脸的二分类器。 steps : 1. Load the data2. Define a Convolutional Neural Network3. Train the Model4. Evaluate the Performance of our trained mo ...
分类:
其他好文 时间:
2020-04-17 16:00:26
阅读次数:
145
题目描述 给定一个二叉树,计算整个树的坡度。 一个树的节点的坡度定义即为,该节点左子树的结点之和和右子树结点之和的差的绝对值。空结点的的坡度是0。 整个树的坡度就是其所有节点的坡度之和。 示例: 题目链接: https://leetcode cn.com/problems/binary tree t ...
分类:
其他好文 时间:
2020-04-17 12:40:30
阅读次数:
57
A.Binary Tree Traversals(二叉树) 题意: 给出一颗二叉树的先序和中序,求后序 题解: 递归建树,细节不表。 #include<cstdio> #include<algorithm> #include<cstring> using namespace std; const i ...
分类:
其他好文 时间:
2020-04-16 20:57:57
阅读次数:
66
import java.util.* class Solution { fun minDepth(root: TreeNode?): Int { if (root == null) { return 0 } var depth = 0 //LinkedList实现了Queue接口,可以用作队列使用 ...
分类:
其他好文 时间:
2020-04-16 15:12:48
阅读次数:
56
Given a binary tree, return the values of its boundary in anti-clockwise direction starting from root. Boundary includes left boundary, leaves, and ri ...
分类:
其他好文 时间:
2020-04-15 21:10:31
阅读次数:
65
传送门:https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree/ 给定一个二叉树, 找到该树中两个指定节点的最近公共祖先。 百度百科中最近公共祖先的定义为:“对于有根树 T 的两个结点 p、q,最近公共祖先表示 ...
分类:
其他好文 时间:
2020-04-15 18:10:47
阅读次数:
71