Given a binary tree rooted at root, the depth of each node is the shortest distance to the root. A node is deepest if it has the largest depth possibl ...
分类:
其他好文 时间:
2020-02-06 11:07:31
阅读次数:
74
Given two binary search trees root1 and root2. Return a list containing all the integers from both trees sorted in ascending order. Example 1: Input: ...
分类:
其他好文 时间:
2020-02-06 10:51:59
阅读次数:
43
二叉树之字形层序遍历。题意是给一个二叉树,对其进行层序遍历,但是在遍历每一层的时候要一次从左开始一次从右开始。例子, Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 return its zigzag level orde ...
分类:
其他好文 时间:
2020-02-06 10:24:34
阅读次数:
81
找BST里最近的值,用两次logn的搜索。注意递归过程中记录遇到过的closest。 看了题解可以不用递归,而且一次搜索中完成。 # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # sel ...
分类:
其他好文 时间:
2020-02-06 01:06:41
阅读次数:
59
typora下载 typora不知为啥,直接下载不下来,所以在ubuntu下不能直接安装 安装方法 进入windows,下载好迅雷 进入 "官网" ,拉到最底下,点击linux 点击下载指示窗口下方 binary file,右键用迅雷下载binary file ubuntu下离线安装 下载完成后将此 ...
分类:
系统相关 时间:
2020-02-05 18:52:45
阅读次数:
247
以上我們談了一些 邏輯的基礎,接下來我們會談一些 數學的基礎,也就是整數與實數系統。其實我們已經用了很多,非正式地,接下來我們會正式地討論他們。要 建構 實數系統的一個方法就是利用公理跟集合論來建構。首先我們需要從集合論出發,定義在 set $A$ 上的 二元運算子(binary operator)... ...
分类:
其他好文 时间:
2020-02-05 10:13:59
阅读次数:
62
二叉树结构变化 例 lintcode 453. Flatten Binary Tree to Linked List https://www.lintcode.com/problem/flatten-binary-tree-to-linked-list/ traversal :因为是按照前序遍历的顺 ...
分类:
其他好文 时间:
2020-02-05 10:04:59
阅读次数:
68
1. contains: 进行大小写敏感的判断,某个字符串是否包含在指定的字段中,这个判断条件使用大小写敏感进行判断,因此在被翻译成“SQL”语句的时候,会使用“like binary”, 而“like binary”就是使用大小写敏感进行判断。 2. icontains: 进行大小写不敏感的判断, ...
分类:
编程语言 时间:
2020-02-04 23:36:34
阅读次数:
104
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes ...
分类:
其他好文 时间:
2020-02-04 15:45:09
阅读次数:
77
题目 用$n$个点组成二叉树,问高度$\geq h$的有多少个。 分析 首先前缀和相减就能得到答案,做dp 设$dp[n][h]$表示节点数为$n$,高度不超过$h$的树的个数 那么$dp[n][h]=\sum_{i=0}^{n 1}dp[i][h 1] dp[n i 1][h 1]$ 最后输出$d ...
分类:
其他好文 时间:
2020-02-04 15:29:33
阅读次数:
56