Rosalind第81题:Linguistic Complexity of a Genome

Problem

Given a length  string  formed over an alphabet  of size , let the "substring count"  denote the total number of distinct substrings of . Furthermore, let the "maximum substring count"  denote the maximum number of distinct substrings that could appear in a string of length  formed over .

The linguistic complexity of  (written ) is equal to ; in other words,  represents the percentage of observed substrings of  to the total number that are theoretically possible. Note that , with smaller values of  indicating that  is more repetitive.

As an example, consider the DNA string () . In the following table, we demonstrate that  by considering the number of observed and possible length  substrings of , which are denoted by  and , respectively. (Observe that  and .)

给定长度  串 由字母组成  大小 ,让“子字符串计数”  表示的不同子字符串的总数 。此外,让“最大子串数” 表示可能出现在长度字符串中的最大不同子字符串数  形成 。

语言复杂的 (书面 )等于 ; 换一种说法, 表示观察到的子字符串的百分比 达到理论上可能的总数。注意,具有较小的值  表明  更重复。

例如,考虑DNA字符串() 。在下表中,我们演示了 通过考虑观察到的数量和可能的长度  的子串 ,由表示  和 , 分别。(观察到 和 )

   
134
258
367
466
555
644
733
822
911
Total3540

 

Given: A DNA string  of length at most 100 kbp.

Return: The linguistic complexity .

给出: DNA字符串长度最多100kbp

回报:语言的复杂性。

Sample Dataset

ATTTGGATT

Sample Output

0.875
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值