Rosalind第87题:Creating a Restriction Map

Problem

Figure 1. In the simplified figure above, we know that the dashed segments came from a chromosome; we desire a collection of numbers whose differences match the lengths of the dotted lines, which will correspond to the locations of restriction sites on the unknown chromosome. Taken from Jones & Pevzner, An Introduction to Bioinformatics Algorithms.

图1 在上面的简化图中,我们知道虚线部分来自染色体。我们需要一个数字集合,这些数字的差异与虚线的长度匹配,虚线的长度将与未知染色体上限制性酶切位点的位置相对应。摘自Jones&Pevzner,《生物信息学算法简介》。

For a set  containing numbers, the difference multiset of  is the multiset  defined as the collection of all positive differences between elements of . As a quick example, if , then we will have that .

If  contains  elements, then  will contain one element for each pair of elements from , so that  contains  elements (see combination statistic). You may note the similarity between the difference multiset and the Minkowski difference , which contains the elements of  and their negatives. For the above set ,  is .

In practical terms, we can easily obtain a multiset  corresponding to the distances between restriction sites on a chromosome. If we can find a set  whose difference multiset  is equal to , then  will represent possible locations of these restriction sites. For an example, consult Figure 1.

Given: A multiset  containing  positive integers for some positive integer .

Return: A set  containing  nonnegative integers such that .

对于一个 包含数字时,差多重集的是多重集定义为所有集合的元素之间的差异。举一个简单的例子,如果,那么我们将拥有。 

如果包含元素,则对于中的每对元素将包含一个元素,因此包含元素(请参阅组合统计)。您可能会注意到差分多重集和Minkowski差分之间的相似性,其中包含的元素及其负数。对于以上设置,为。 

实际上,我们可以轻松地获得与染色体上限制位点之间的距离相对应的多集。如果我们找到一个差异多重集等于的集合,则将代表这些限制位点的可能位置。有关示例,请参阅图1

给定:一个多集,其中包含一些正整数的正整数。

返回:包含诸如这样的非负整数的集合

Sample Dataset

2 2 3 3 4 5 6 7 8 10

Sample Output

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值