Difference between revisions of "Ilsun Yun/Homework2/SourceCode"
imported>Ilsun yun (Created page with "<p>#include<iostream><br /> #include <vector><br /> #include <algorithm></p> <p>using namespace std;<br /> vector<int> output;</p> <p>int check(int arr[...") |
imported>Ilsun yun |
||
Line 1: | Line 1: | ||
− | <p>#include<iostream>< | + | <p>#include<iostream></p> |
− | #include <vector>< | + | |
− | #include <algorithm></p> | + | <p>#include <vector></p> |
+ | |||
+ | <p>#include <algorithm></p> | ||
<p>using namespace std;<br /> | <p>using namespace std;<br /> |
Latest revision as of 03:38, 1 December 2018
#include<iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> output;
int check(int arr[25][25]){
for(int i=0;i<25;i++){
for(int j=0;j<25;j++){
if(arr[i][j]>0){
if(arr[i+1][j+1]==1){
arr[i+1][j+1]=arr[i+1][j+1]+arr[i][j];
arr[i][j]=0;
}
}
}
}
return arr[25][25];
}
int main()
{
string sample1 = "AAGAATAGTATTTCGCTTTTTTATA";
string sample2 = "AGAAATAGTATTTCGGTTAATTATA";
int samparray[25][25];
for(int i=0;i<25;i++){
for(int j=0;j<25;j++){
if(sample1[i]==sample2[j]){
samparray[i][j]=1;
} else {
samparray[i][j]=0;
}
}
}
check(samparray);
for(int i=0;i<25;i++){
for(int j=0;j<25;j++){
cout<<samparray[i][j]<<" ";
}
cout <<endl;
}
cout <<"The contigs sorting..." << endl;
for(int i=0;i<25;i++){
for(int j=0;j<25;j++){
if(samparray[i][j]>0){
int a = samparray[i][j];
output.push_back(a);
}
}
}
sort(output.begin(),output.end());
for(int i=output.size()-1;i>=0;i--){
cout<<output[i]<<endl;
}
}