9 Matching Annotations
- Jul 2022
-
programmercarl.com programmercarl.com代码随想录1
-
二分查找涉及的很多的边界条件,逻辑比较简单,但就是写不好。例如到底是 while(left < right) 还是 while(left <= right),到底是right = middle呢,还是要right = middle - 1呢? 大家写二分法经常写乱,主要是因为对区间的定义没有想清楚,区间的定义就是不变量。要在二分查找的过程中,保持不变量,就是在while寻找中每一次边界的处理都要坚持根据区间的定义来操作,这就是循环不变量规则。 写二分法,区间的定义一般为两种,左闭右闭即[left, right],或者左闭右开即[left, right)。
思路简单,但是实现容易出错,需要背诵模板
-
- Oct 2020
-
leetcode-cn.com leetcode-cn.com
-
无矛盾的最佳球队
回溯法?
-
- Apr 2019
-
github.com github.com
-
- Jan 2019
-
en.wikipedia.org en.wikipedia.org
-
A rooted binary tree is full if every vertex has either two children or no children.
Example of Catalan Numbers use case.
Tags
Annotators
URL
-
- Nov 2018
-
codeburst.io codeburst.io
-
codeburst.io codeburst.io
- Sep 2016
-
cs.brown.edu cs.brown.edu
-
Pascal was designed in a very orderly approach,
Pascal built from Algo
Tags
Annotators
URL
-