Skip to content

Instantly share code, notes, and snippets.

@rajithv
Created June 19, 2015 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajithv/dc0d12604fec65e56bdf to your computer and use it in GitHub Desktop.
Save rajithv/dc0d12604fec65e56bdf to your computer and use it in GitHub Desktop.
int findMinDist(vector<int> vec1, vector<int> vec2){
float dif = 1000000000;
int pos = 0;
for(int i=0; i<vec1.size()-6; i++){
float temp2 = 0;
for(int j=5; i+j<vec1.size()-5; j++){
temp2 += (vec1[i+j] - vec2[j])*(vec1[i+j] - vec2[j]);
}
temp2 = temp2/((vec1.size()-i)*1.0);
cout << i << " " << temp1 << " " << temp2 << endl;
// Select only overlaps of 25% or more. (Smaller overlaps tend to give lesser results for most cases)
if(temp2 < dif && i < vec1.size()/4*3){
dif = temp2;
pos = i;
}
}
return pos;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment