![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法笔记
文章平均质量分 75
「已注销」
这个作者很懒,什么都没留下…
展开
-
LeetCode[16]: 3Sum Closest
题目描述 Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have e...原创 2018-03-10 10:59:08 · 159 阅读 · 0 评论 -
算法——有序数组中值
题目描述 有两个已排序数组A、B,各自大小分别为m,n。找到两个已排序数组的中值。 解题思路 将整个集合分为两个等长的子集,使一边的值总是大于另一边。这道题,可以将A、B看作一个整体,然后划分为左右两部分L和R,并且满足max(L)<=min(R)max(L)<=min(R) max(L)max(L)max(L) max(L) 当总个数(m+n)为偶数时,结果为:max(...原创 2018-03-06 09:13:21 · 507 阅读 · 0 评论 -
笔记:红黑树旋转和插入
红黑树 红黑树是每个节点都带有颜色属性的二叉查找树,颜色或红色或黑色。在二叉查找树强制一般要求以外,对于任何有效的红黑树我们增加了如下的额外要求: - 性质1. 节点是红色或黑色。 - 性质2. 根节点是黑色。 - 性质3. 每个叶节点(NIL节点,空节点)是黑色的。 - 性质4. 每个红色节点的两个子节点都是黑色。(从每个叶子到根的所有路径上不能有两个连续的红色节点) - 性质5. ...原创 2018-04-25 22:24:33 · 417 阅读 · 0 评论