View Single Post
  #9  
Old 10-29-2009, 10:57 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
That's a hell of a lot of temp's though! And is there really a lot of confusion? I mean in this day and age usually if you see a var without a prefix you can undoubtedly know that it is a temp var. And it looks so much neater!

PHP Code:
function levenshtein(st) {
  
temp.s.length();
  
temp.t.length();
  
  
temp.= new[m][n];
  for (
temp.0<= mi++) d[i][0] = i;
  for (
temp.0<= nj++) d[0][j] = j;
  
  for (
temp.1<= nj++) {
    for (
temp.1<= mi++) {
      if (
s.charat(i-1) == t.charat(j-1)) { 
        
d[i][j] = d[i-1][j-1];
      } else {
        
d[i][j] = min(d[i-1][j] + 1,
                      
min(d[i][j-1] + 1d[i-1][j-1] + 1)
                     );
      }
    }
  }
  return 
d[m-1][n-1];

Reply With Quote