Advertisement
Guest User

Untitled

a guest
May 26th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. string ref = "GATA";
  2. string align = "GAT";
  3.  
  4. string alignmentA = "";
  5. string alignmentB = "";
  6. int i = ref.length(); //αριστερή λέξη (αρα το index1 απεικονίζει γραμμές)
  7. int j = align.length(); //πάνω λέξη (άρα το index2 απεικονίζει στήλες)
  8. int diag;
  9. int up;
  10. int left;
  11.  
  12. //Το σημείο (index1, index2) δείχνει στο κάτω δεξιά στοιχείο του matrix
  13.  
  14. while(index1>0 || index2>0)
  15. {
  16. diag = matrix(i-1, j-1);
  17. up = matrix(i-1, j);
  18. left = matrix(i, j-2);
  19.  
  20. int max = max(diag,up,left);
  21.  
  22. if(diag is max)
  23. {
  24. i -= 1;
  25. j -= 1;
  26. alignmentA = ref(i) + alignmentA;
  27. alignmentB = ref(i) + alignmentB;
  28.  
  29. }
  30.  
  31. if(left is max)
  32. {
  33. alignmentB = "-" + alignmentB;
  34. j -= 1;
  35. }
  36.  
  37. if(up is max)
  38. {
  39. alignmentA = "-" + alignmentA;
  40. i -= 1;
  41. }
  42.  
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement