DFS, unlimited TLE, and ugly code
// Version 1 TLE # include
# Include
# Include
# Define MAX_INT 2147483647 # define MAXN 105 using namespace std; int Map [5] [5] = {0,-3,-4,-2,-1 }, {-3, 5,-1,-2,-1}, {-4,-,-3,-2}, {-2,-2, -2},
Given a string, the two strings are composed of A, T, G, and C, and are paired with each other. You can insert a dry space for each of them to obtain the final sum and the maximum value.
The following States can be defined. f [I] [J] indicates that 1
# Include char S1 [110], S2 [110]; int d [110] [110]; int P [5] [5] = {0,-3, -4,-2,-1}, {-3, 5,-1,-2,-1}, {-4,-1, 5,-3,-2 }, {-2,-2,-3, 5,-2}, {-1,-1,-2,-2, 5}; int max (int A, int B, int c) {If (B> A) A = B; If (C> A) A = C; return a;} int dp (INT
# Include # include # include # include using namespace STD; int map [5] [5] = {5,-1,-2,-1,-3}, {-1, 5, -3,-2,-4}, {-2,-3, 5,-2,-2}, {-1, -2,-2, 5,-1}, {-3,-4,-2,-1, 0 }}; char gene1 [102], gene2 [102]; int DP [102] [102]; int main (
Question:
For two strings consisting of four characters: A, C, T, and G, you can add-to the two strings so that the two strings are of the same length.
Each two-character match has a value. The two-character cannot match.
Solution:
This is converted
Question: it is A variant of the longest common subsequence. The characters in this question are only A, G, C, and T, plus '-'; different matches have different weights W. Only matching with the same character has a weight greater than 0, and other
// DP dynamic planning, deformation of LCS problems. Based on the classic LCS model, we use DP [I, j] to represent the optimal values matching I and j. the final answer is DP [len1] [len2] // obviously there are two situations: // 1. S1 [I] = S2
R is an open-source Statistical Computing and drawing language, which is similar to S. The syntax of R is very similar to that of other languages and has powerful functions. You can check it out here. Home is http://www.r-project.org/You can click
Calculate the similarity between two DNA base sequences. you can insert spaces to match any base. The question shows the price of any match.
Idea: score [I] [J] isMaximum values: seq1 [I] And seq2 [J] match + score [I-1] [J-1]; space and seq1 [I]
A classic 2D DP problem. A disguise of LCS-actually not very hard to decode: it is about 2 sequences 'matching, though with a weight value of each match.
The point of this problem: how to decode Problem Statement and how to distill the actuall model
/* This code is submitted by IRIS for problem 1316 at 12:19:13 */# include # include using namespace STD; // If DP is used for this problem, you need to consider // DP [I] [J] For I, maximum similarity of J: // DP [I] [J] = max {DP [I-1] [J-1] +
Link: pku1080Hdu1080 tzc1287
Method: Dynamic Planning
Thought: This question is a variant of the longest common subsequence. It only replaces the longest length with the largest matching.Value, you can use a two-dimensional array W to save the
Problem address: http://poj.org/problem? Id = 1080
[Idea]
Deformation of an lcs.
Set space to 0, A to 1, C to 2, g to 3, and t to 4.
State transition equation: DP [I] [J] = max (DP [I-1] [J-1] + value [A [I] [B [J], DP [I-1] [J] + value [A [I] [0],
Question:Chain agtgatgGttagVariable formAGTGAT-GGT--TAGTo obtain and maximizeAnalysis:The DP problem is a deformation Question of the longest common subsequence. The current problem is stored using two-dimensional DP [I] [J ].The sum of the I and J
Some deformation of the series in the title, each number of values into its subscript minus the number of the last occurrence of the subscript, so that if the first occurrence of each number is not considered to be a normal string match, and a
Topic links
The main topic: given a length of n of the base sequence s and a length of m of the base sequence T, now want to complement a certain base in the sequence T to make the sequence s and sequence T pair, the number of solutions
Solution:
, psychological characteristics, social behavior, and disease resistance. These traits are usually hereditary, as the Chinese saying goes, "man sows, reap." But there are some traits that may vary from one environment to the other, for example, a tall son may grow smaller due to malnutrition in the growing season, although he may actually have inherited a very high gene. Under the common influence of genes and environment, it is very complicated to sa
Mainly from: Http://mp.weixin.qq.com/s/iTnsYajtHsbieGILGpUYgQThe gold standard for sequencing: a generation of sequencing, so called golden Sequencing.High-throughput sequencing the recent years have been a fire more and more fire, but the world is still a bunch of molecular cloning, cell breeding, bacteria, mixed protein biologists, the reason for the Sanger sequencing or sequencing of the gold standard, because the accuracy of more than 2, 3-generation sequencing and maintain the price of Chin
JAVA-based Genetic Algorithm
The detailed principles and specific definitions of genetic algorithms are not described here. If you want to know more about them, you can use Baidu. Below we will briefly introduce your understanding of genetic algorithms, this article uses binary rules for gene encoding.
Algorithm idea:
According to Darwin's evolution, genetic algorithms consider that species develop in a positive direction (Survival of the fittest). T
more kangaroos who live longer at higher altitudes, the more likely they are to have children. So after many years, these kangaroos are not consciously gathered to a mountain, but in all the Kangaroos, only the kangaroo gathered to Mount Everest was brought back to the beautiful Australia. )The following is a description of the process of genetic algorithm implementation.The realization process of genetic algorithmThe process of implementing genetic algorithms is actually like the evolutionary
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.