Ilsun Yun/Homework2/SourceCode
#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;
}
}