Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r ...
分类:
其他好文 时间:
2019-05-24 14:13:34
阅读次数:
85
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and ...
分类:
其他好文 时间:
2019-05-23 20:48:23
阅读次数:
85
Return any binary tree that matches the given preorder and postorder traversals. Values in the traversals and are distinct?positive integers. Example ...
分类:
其他好文 时间:
2019-05-23 00:01:38
阅读次数:
136
[toc] 这篇文章主要讲 map 的赋值、删除、查询、扩容的具体执行过程,仍然是从底层的角度展开。结合源码,看完本文一定会彻底明白 map 底层原理。 我要说明的是,这里对 map 的基本用法涉及比较少,我相信可以通过阅读其他入门书籍了解。本文的内容比较深入,但是由于我画了各种图,我相信很容易看懂 ...
分类:
编程语言 时间:
2019-05-22 09:37:58
阅读次数:
170
【二叉树】 1. 实现一个二叉查找树,并且支持插入、删除、查找操作 2. 实现查找二叉查找树中某个节点的后继、前驱节点 3. 实现二叉树前、中、后序以及按层遍历 练习: 1. 翻转二叉树 https://leetcode-cn.com/problems/invert-binary-tree/ 思路: ...
分类:
编程语言 时间:
2019-05-22 09:16:33
阅读次数:
140
二叉搜索树的概念 从前面讨论折半搜索的性能中可知,如果每次从搜索序列的中间进行搜索,把区间缩小一半,通过有限次迭代,很快就能通近到所要寻找的元素。进一步,如果我们直接输入搜索序列,构造出类似于折半搜索的判定树那样的树形结构,就能实现快速搜索。这种树形结构就是二又搜索树。 二又搜索树(binary s ...
分类:
编程语言 时间:
2019-05-20 19:13:35
阅读次数:
127
1、布尔值 最基本的数据类型就是简单的true/false值,在JavaScript和TypeScript里叫做boolean(其它语言中也一样)。 2、数字 和JavaScript一样,TypeScript里的所有数字都是浮点数。 这些浮点数的类型是 number。 除了支持十进制和十六进制字面量 ...
分类:
其他好文 时间:
2019-05-20 17:09:34
阅读次数:
100
二叉搜索树(Binary Search Tree) 二叉搜索树是一种二叉树,子结点数量上限为2;为了方便搜索,结点是有序的,左结点的key不大于父节点,右节点的key不小于父节点,且左右子树也是二叉搜索树。 下面是一个二叉搜索树的样图,来自维基 一棵树一般都要提供一些函数,例如遍历,搜索,最大最小值 ...
分类:
其他好文 时间:
2019-05-19 23:25:04
阅读次数:
146
199. 二叉树的右视图 199. Binary Tree Right Side View 题目描述 给定一棵二叉树,想象自己站在它的右侧,按照从顶部到底部的顺序,返回从右侧所能看到的节点值。 Given a binary tree, imagine yourself standing on the ...
分类:
其他好文 时间:
2019-05-19 20:41:51
阅读次数:
130
938. Range Sum of BST Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The b ...
分类:
其他好文 时间:
2019-05-19 14:33:40
阅读次数:
120