Sequence

612.1.004 ALGS4 | Elementary Sorts

半世苍凉 提交于 2020-05-04 23:34:29
sublime编辑器写代码,命令行编译 减少对ide的依赖//可以提示缺少什么依赖import 所有示例代码动手敲一遍 Graham's Scan是经典的计算几何算法 shffule 与 map-reduce 有关—— 云计算 知道这些算法在身边切实的应用,对学习动力很有帮助 下一章开始,使用 git进行源代码管理! 先用来做自己的项目管理 Inspiration 计算机思维——不要重复造轮子 零件的通用性——拆分拆分再拆分,专业与分工细致 1.Callback = reference to executable code 核心思想是将函数作为实参传递给其他函数 Interface-Java 使我们能够以类型安全的方式使用为任何类型的数据开发的排序算法 Roadmap 对象需要实现Compareble Interface() 这些数据类型具有重新实现compareTo()方法的实例方法 排序实现里与数据类型无关 具体的比较由Comparable 接口处理 What I can use —— code Selection Sort | 选择排序 Insertion Sort | 插入排序 ShellSort | 希尔排序 点击链接可看动画演示 1 Two useful sorting abstrations Less private static boolean less

[LeetCode] Bricks Falling When Hit 碰撞时砖头掉落

独自空忆成欢 提交于 2020-05-04 10:19:21
We have a grid of 1s and 0s; the 1s in a cell represent bricks. A brick will not drop if and only if it is directly connected to the top of the grid, or at least one of its (4-way) adjacent bricks will not drop. We will do some erasures sequentially. Each time we want to do the erasure at the location (i, j), the brick (if it exists) on that location will disappear, and then some other bricks may drop because of that erasure. Return an array representing the number of bricks that will drop after each erasure in sequence. Example 1: Input: grid = [[1,0,0,0],[1,1,1,0]] hits = [[1,0]] Output: [2]

Oracle入门学习六

。_饼干妹妹 提交于 2020-05-04 10:11:09
事务:把一组操作看做一个工作单元,要么都执行,要么都不执行。dml操作才有事务,查询没有事务。 开始事务:从上一次的事务结束之后,从第一次dml操作,就自动开启了事务 提交事务:commit 回滚事务:rollback create table bank ( id number ( 5 ) primary key , money number ( 10 ) check ( money > 0 ) ) insert into bank values ( 1 , 3000 ); insert into bank values ( 2 , 5000 ); update bank set money = money - 1000 where id = 1 ; update bank set money = money + 1000 where id = 2 ; begin update bank set money = money - 1000 where id = 1 ; update bank set money = money + 1000 where id = 2 ; commit ; exception when others then rollback ; end ; select * from bank; 视图:一个虚拟表,不存放数据,只存sql

Oracle入门学习六

孤街醉人 提交于 2020-05-04 09:43:19
事务:把一组操作看做一个工作单元,要么都执行,要么都不执行。dml操作才有事务,查询没有事务。 开始事务:从上一次的事务结束之后,从第一次dml操作,就自动开启了事务 提交事务:commit 回滚事务:rollback create table bank ( id number ( 5 ) primary key , money number ( 10 ) check ( money > 0 ) ) insert into bank values ( 1 , 3000 ); insert into bank values ( 2 , 5000 ); update bank set money = money - 1000 where id = 1 ; update bank set money = money + 1000 where id = 2 ; begin update bank set money = money - 1000 where id = 1 ; update bank set money = money + 1000 where id = 2 ; commit ; exception when others then rollback ; end ; select * from bank; 视图:一个虚拟表,不存放数据,只存sql

Akka Stop Kill PoisonPill 区别

笑着哭i 提交于 2020-05-04 09:36:54
Akka Stop Kill PoisonPill 区别 Both stop and PoisonPill will terminate the actor and stop the message queue. They will cause the actor to cease processing messages, send a stop call to all its children, wait for them to terminate, then call its postStop hook. All further messages are sent to the dead letters mailbox. The difference is in which messages get processed before this sequence starts. In the case of the stop call, the message currently being processed is completed first, with all others discarded. When sending a PoisonPill , this is simply another message in the queue, so the sequence

Plants vs. Zombies(2018ICPC青岛站E题) 二分

怎甘沉沦 提交于 2020-05-04 06:13:32
Plants vs. Zombies                                                ZOJ - 4062 BaoBao and DreamGrid are playing the game Plants vs. Zombies . In the game, DreamGrid grows plants to defend his garden against BaoBao's zombies There are plants in DreamGrid's garden arranged in a line. From west to east, the plants are numbered from 1 to and the -th plant lies meters to the east of DreamGrid's house. The -th plant has a defense value of and a growth speed of . Initially, for all . DreamGrid uses a robot to water the plants. The robot is in his house initially. In one step of watering, DreamGrid will

PAT A1007 Maximum Subsequence Sum (25 分)——最大子列和,动态规划

岁酱吖の 提交于 2020-05-04 05:07:04
Given a sequence of K integers { N ​ 1 ​​, N ​ 2 ​​, ..., N ​ K ​​ }. A continuous subsequence is defined to be { N ​ i ​​, N ​ i + 1 ​​, ..., N ​ j ​​ } where 1. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For example, given sequence { -2, 11, -4, 13, -5, -2 }, its maximum subsequence is { 11, -4, 13 } with the largest sum being 20. Now you are supposed to find the largest sum, together with the first and the last numbers of the maximum subsequence. Input Specification: Each input file contains one test case. Each case occupies two lines.

1135. Is It A Red-Black Tree (30)

心不动则不痛 提交于 2020-05-04 04:42:04
1135. Is It A Red-Black Tree (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties: (1) Every node is either red or black. (2) The root is black. (3) Every leaf (NULL) is black. (4) If a node is red, then both its children are black. (5) For each node, all simple paths from the node to descendant leaves contain the same number of black nodes. For example, the tree in Figure 1 is a red-black tree, while the ones in Figure 2 and 3 are not. Figure 1

PAT 1135 Is It A Red-Black Tree

烂漫一生 提交于 2020-05-04 04:41:49
There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties: (1) Every node is either red or black. (2) The root is black. (3) Every leaf (NULL) is black. (4) If a node is red, then both its children are black. (5) For each node, all simple paths from the node to descendant leaves contain the same number of black nodes. For example, the tree in Figure 1 is a red-black tree, while the ones in Figure 2 and 3 are not. Figure 1 Figure 2 Figure 3 For each given binary search tree, you are supposed to tell if it is a legal red-black

python编写PAT 1007 Maximum Subsequence Sum(暴力 分治法 动态规划)

蓝咒 提交于 2020-05-04 04:36:14
python编写PAT甲级 1007 Maximum Subsequence Sum wenzongxiao1996 2019.4.3 题目 Given a sequence of K integers { N​1, N2, ..., N​K}. A continuous subsequence is defined to be { N​i, N​i+1, ..., N​j} where 1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For example, given sequence { -2, 11, -4, 13, -5, -2 }, its maximum subsequence is { 11, -4, 13 } with the largest sum being 20. Now you are supposed to find the largest sum, together with the first and the last numbers of the maximum subsequence. Input Specification: Each input file contains one