ana.bela2015 Posted April 28, 2015 Report Share Posted April 28, 2015 Não entendo nada de Java, mas preciso muito fazer esse programa funcionar, porque preciso da matriz que ele faz. Não ta rodando, acho que está incompleto. String a ="GATTACA"; String b = "GCATGCA"; int gap = -1 substitution= -1 match = 1; int[][] opt = new int[a.length() + 1][b.length() + 1]; for (int i = 1; i <= a.length(); i++) opt[0] = opt[i-1][0] + gap; for (int j = 1; j <= b.length(); j++) opt[0][j] = opt[0][j - 1] + gap; for (int i = 1; i <= a.length(); i++) { for (int j = 1; j <= b.length(); j++) { int costDiag; if ((a.charAt(i-1) == b.charAt(j-1)) scoreDiag= opt[i-1][j-1] + match; else scoreDiag= opt[i-1][j-1] + substitution; int costLeft = opt[j-1] + gap; int costUp = opt[i-1][j] + gap; opt[j] = Math.min(Math.min(costDiag, costLeft), costUp); } } Quote Link to comment Share on other sites More sharing options...
0 Pualo Henrique Posted May 6, 2015 Report Share Posted May 6, 2015 Posta a finalidade do programa o que ele deve fazer ai fica mais fácil de entender. Quote Link to comment Share on other sites More sharing options...
0 thomaz pereira Posted May 15, 2015 Report Share Posted May 15, 2015 se esse for o codigo completo impossivel de rodar se for esse pesquise sintaxe java se não for desculpe sou iniciante tambem Quote Link to comment Share on other sites More sharing options...
Question
ana.bela2015
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.