简体   繁体   English

子集的排列和随后的运行时分析

[英]Permutations of subsets and subsequent run-time analysis

I have 2 questions: 我有两个问题:

  1. I would like to generate the permutations of subsets eg There are 20 possible amino acids and 5 positions where they can occur. 我想生成子集的排列,例如,有20种可能的氨基酸和5种可能发生的位置。 What are the total permutations that can occur (in text) 可能发生的总排列是什么(文本中)

  2. Once I have this list of permutations certain values will be assinged to each one and I would like to look up any given permutation at run time. 一旦我有了这个排列列表,就会给每个值添加一些值,我想在运行时查找任何给定的排列。 The first idea that comes to mind is a look-up table, but I was wondering if there might be a better way of doing this. 想到的第一个想法是一个查找表,但我想知道是否有更好的方法来做到这一点。

  1. You want combinations of length 5, not permutations. 你想要长度为5的组合,而不是排列组合。 This is a standard problem, which can be solved with recursion. 这是一个标准问题,可以通过递归来解决。 Use CombinationGenerator if you don't want to write it yourself. 如果您不想自己编写,请使用CombinationGenerator

  2. Number the combinations using base 20 (not to be confused with the chemical definition of base). 使用基数20对组合进行编号(不要与碱的化学定义混淆)。 Use a hashtable if you'll be storing data for a limited subset of combinations, or a look-up array if you'll be most of them. 如果您要为有限的组合子集存储数据,请使用哈希表;如果您是大多数组合,则使用查找数组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM