Sequence

2018.12.7

耗尽温柔 提交于 2021-02-11 17:28:37
2018-12-07 bzoj3172 :AC自动机,建出fail树,加入一个字符串在fail树的链上每个点+1,每个点的答案为子树中的所有点权的和。 bzoj3110 :整体二分+线段树。 2018-12-09 HDU2825 :AC自动机+状压dp。 HDU6086 :AC自动机+状压dp bzoj2434: AC自动机+fail树+dfs序+树状数组。 2018-12-11 CF1084D: dfs出子树内到到根的最长次长的路径,直接可以合并,不合法的一定不更优。 CF1084E :建出trie树,模拟。 CF1083C: 线段树维护一个区间内是否可以存在于一条路径上。 nowcoder wannafly 25 E: 线段树维护矩阵转移 HDU5608: 线段树维护矩阵转移,修改一个矩阵,询问区间矩阵乘积。 2018-12-12 bzoj1111 :转化为4进制数,考虑每位是否借位,dp。 2018-12-13 bzoj2827: splay标记。 bzoj1058: 平衡树前驱后继。 bzoj1251: splay翻转,求max。 bzoj3809: 对权值分块。 bzoj1014: splay维护hash值,二分+hash求lcp。 bzoj4825: 找单旋性质,区间操作,求前驱后继。 2018-12-29 CF 1093 E :cdq分治+树状数组。 CF 1093

Python switching multiple positions in string each to multiple letters

亡梦爱人 提交于 2021-02-11 14:20:20
问题 I am trying to write a python code that finds restriction enzyme sites within a sequence of DNA. Restriction enzymes cut at specific DNA sequences, however some are not so strict, for example XmnI cuts this sequence: GAANNNNTTC Where N can be any nucleotide (A, C, G, or T). If my math is right thats 4^4 = 256 unique sequences that it can cut. I want to make a list of these 256 short sequences, then check each one against a (longer) input DNA sequence. However, I'm having a hard time

awk find missing number in sequence from file1 and append to column in file2

被刻印的时光 ゝ 提交于 2021-02-11 13:47:04
问题 hi as suggested in previous question, i will try more clarify what i want to achieve. as in file1, in column $4 i have numbers which are not continuosly sequenced like 1,2,3,4,5.. , it means i need print those missing ones e.g. after number 3 i should get number 4 and so on cat file1 A R5 A48 1 B R5 A48 2 C R4 A48 3 D R8 A48 15 E R9 A48 22 F R20 B55 21 G R55 B22 19 R B1 I77 14 AA B8 PP 18 BX A255 PA 7 CA A77 PB 10 WW W7 PX 11 i find out partly solution in this awk one liner returning arr=($

awk find missing number in sequence from file1 and append to column in file2

偶尔善良 提交于 2021-02-11 13:45:21
问题 hi as suggested in previous question, i will try more clarify what i want to achieve. as in file1, in column $4 i have numbers which are not continuosly sequenced like 1,2,3,4,5.. , it means i need print those missing ones e.g. after number 3 i should get number 4 and so on cat file1 A R5 A48 1 B R5 A48 2 C R4 A48 3 D R8 A48 15 E R9 A48 22 F R20 B55 21 G R55 B22 19 R B1 I77 14 AA B8 PP 18 BX A255 PA 7 CA A77 PB 10 WW W7 PX 11 i find out partly solution in this awk one liner returning arr=($

SQL to get 2 adjacent actions from the flag

百般思念 提交于 2021-02-11 12:50:26
问题 hope you are doing well! I have an dummy data as below. I want to get 2 adjacent actions from the flag by each user. Here's the chart to describe my thought. Here's what I want: How can I implement SQL(I use Google Bigquery)? Hope someone can light me up. Thanks a million! 回答1: You seem to want lag() . I would leave the "action sequence" as two separate columns: select user, prev_action, action, flag from (select t.*, lag(action) over (partition by user order by sequence) as prev_action from

How to find the max. number of times a sequence of characters repeats consecutively in Python?

余生颓废 提交于 2021-02-10 14:49:01
问题 I'm working on a cs50/pset6/dna project. I'm struggling with finding a way to analize a sequence of strings, and gather the maximum number of times a certain sequence of characters repeats consecutively. Here is an example: String: JOKHCNHBVDBVDBVDJHGSBVDBVD Sequence of characters I should look for: BVD Result: My function should be able to return 3 , because in one point the characters BVD repeat three times consecutively, and even though it repeats again two times, I should look for the

How to find the max. number of times a sequence of characters repeats consecutively in Python?

我与影子孤独终老i 提交于 2021-02-10 14:45:17
问题 I'm working on a cs50/pset6/dna project. I'm struggling with finding a way to analize a sequence of strings, and gather the maximum number of times a certain sequence of characters repeats consecutively. Here is an example: String: JOKHCNHBVDBVDBVDJHGSBVDBVD Sequence of characters I should look for: BVD Result: My function should be able to return 3 , because in one point the characters BVD repeat three times consecutively, and even though it repeats again two times, I should look for the

分布式数据库中间件概念

点点圈 提交于 2021-02-10 06:57:41
从原有的一个库,被切分为多个分片数据库,所有的分片数据库集群构成了整个完整的数据库存储。面对分片集群,数据源切换,事务处理,数据聚合等,是否需要应用程序直接处理这些呢?答案肯定是否定的,这就是数据库中间件存在的原因,把这些统统都交给中间件,应用只专注于业务就行了。 那么应用程序怎么访问数据库中间件呢?和直接访问数据库有什么区别? 通常应用程序不需要知道中间件的存在,业务开发人员只需要知道数据库的概念,所以数据库中间件可以被看做是一个或多个数据库集群构成的逻辑库。对应用来说,逻辑库中读写数据的表就是逻辑表。逻辑表,可以是数据切分后,分布在一个或多个分片库中,也可以不做数据切分,不分片,只有一个表构成。 分片表: 是指那些原有的很大数据的表,需要切分到多个数据库的表,这样,每个分片都有一部分数据,所有分片构成了完整的数据。 非分片表: 是对应于分片表而言的,某些表示可以不用进行切分的。 ER表: 关系型数据库是基于实体关系模型之上,通过其描述了真实世界中事物与关系,Mycat中ER表即使来源于此。根据这一思路,提出了基于ER关系的数据分片策略,子表的记录与所关联的父表记录存放在同一个数据分片上,即子表依赖于父表,通过表分组(Table Group)保证数据Join不会跨库操作。 表分组(Table Group)是解决跨分片数据join的一种很好的思路,也是数据切分规则的重要一条规则。

【STM32H7教程】第44章 STM32H7的ADC基础知识和HAL库API

无人久伴 提交于 2021-02-10 06:31:31
完整教程下载地址: http://www.armbbs.cn/forum.php?mod=viewthread&tid=86980 第44章 STM32H7的ADC基础知识和HAL库API 本章节为大家讲解ADC(Analog-to-digital converters,模数转换器),极具项目使用价值,因为STM32H7的ADC已经高达16位分辨率,支持3.6Msps采样率。 44.1 初学者重要提示 44.2 ADC基础知识 44.3 ADC的HAL库用法 44.4 源文件stm32h7xx_hal_adc.c 44.5 总结 44.1 初学者重要提示 STM32H7虽然支持差分,但不支持负压测量。 STM32H7的ADC采集通道体验快速通道Fast Channels和低速通道Slow Channels的区别,详情看本章2.12小节的电气特性。 STM32H7的ADC支持过采样,通过过采样技术可以做到26位分辨率。 ADC的专业术语诠释文档,推荐大家看看: http://www.armbbs.cn/forum.php?mod=viewthread&tid=89414 。 44.2 ADC基础知识 ADC的几个关键知识点放在开头说: STM32H7支持三路ADC,分别是ADC1,ADC2和ADC3。其中ADC1和ADC2可以组成双ADC模式,ADC3是独立的

Find the longest arithmetic progression inside a sequence

主宰稳场 提交于 2021-02-10 05:09:54
问题 Suppose I have a sequence of increasing numbers, and I want to find the length of longest arithmetic progression within the sequence. Longest arithmetic progression means an increasing sequence with common difference, such as [2, 4, 6, 8] or [3, 6, 9, 12]. For example, for [5, 10, 14, 15, 17] , [5, 10, 15] is the longest arithmetic progression, with length 3; for [10, 12, 13, 20, 22, 23, 30] , [10, 20, 30] is the longest arithmetic progression with length 3; for [7, 10, 12, 13, 15, 20, 21] ,