Diff
checker
Testo
Testo
Immagini
Documenti
Excel
Cartelle
Legal
Enterprise
Applicazione per desktop
Prezzi
Accedi
Scarica Diffchecker Desktop
Confronta il testo
Trova la differenza tra due file di testo
Strumenti
Cronologia
Editor live
Comprimi invariate
Senza a capo
Layout
Diviso
Unificato
Livello di dettaglio
Intelligente
Parola
Carattere
Evidenziazione sintassi
Scegli sintassi
Ignora
Trasforma testo
Vai alla prima modifica
Modifica input
Diffchecker Desktop
Il modo più sicuro per usare Diffchecker. Ottieni l'app Diffchecker Desktop: i tuoi diff non lasciano mai il tuo computer!
Ottieni Desktop
Untitled diff
Creato
9 anni fa
Il diff non scade mai
Eliminare
Esporta
Condividere
Spiegare
7 rimozioni
Linee
Totale
Rimosso
Caratteri
Totale
Rimosso
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
20 linee
Copia tutti
9 aggiunte
Linee
Totale
Aggiunto
Caratteri
Totale
Aggiunto
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
22 linee
Copia tutti
from time import time
from time import time
Copia
Copiato
Copia
Copiato
memo = {}
def LCS(X, Y):
def LCS(X, Y):
Copia
Copiato
Copia
Copiato
if (X, Y) in memo:
return memo[(X, Y)]
if len(X) == 0 or len(Y) == 0:
if len(X) == 0 or len(Y) == 0:
res = []
res = []
elif X[-1] == Y[-1]:
elif X[-1] == Y[-1]:
res = LCS(X[:-1], Y[:-1]) + [X[-1]]
res = LCS(X[:-1], Y[:-1]) + [X[-1]]
else:
else:
res = longest(LCS(X, Y[:-1]), LCS(X[:-1], Y))
res = longest(LCS(X, Y[:-1]), LCS(X[:-1], Y))
Copia
Copiato
Copia
Copiato
memo[(X, Y)] = res
return res
return res
def longest(X, Y):
def longest(X, Y):
Copia
Copiato
Copia
Copiato
if len(X) > len(Y)
:
return X
if len(X) > len(Y)
else
Y
return X
else
:
return
Y
start = time()
start = time()
Copia
Copiato
Copia
Copiato
print("".join(LCS("arn
.
schwarzenegger", "
ar.
chuarcheneger")))
print("".join(LCS("arn
old
schwarzenegger", "
anol
chuarcheneger")))
print("Time elapsed: %.4fs" % (time()
- start))
print("Time elapsed: %.4fs" % (time()
- start))
Diff salvati
Testo originale
Apri file
from time import time def LCS(X, Y): if len(X) == 0 or len(Y) == 0: res = [] elif X[-1] == Y[-1]: res = LCS(X[:-1], Y[:-1]) + [X[-1]] else: res = longest(LCS(X, Y[:-1]), LCS(X[:-1], Y)) return res def longest(X, Y): if len(X) > len(Y): return X else: return Y start = time() print("".join(LCS("arn. schwarzenegger", "ar. chuarcheneger"))) print("Time elapsed: %.4fs" % (time()- start))
Testo modificato
Apri file
from time import time memo = {} def LCS(X, Y): if (X, Y) in memo: return memo[(X, Y)] if len(X) == 0 or len(Y) == 0: res = [] elif X[-1] == Y[-1]: res = LCS(X[:-1], Y[:-1]) + [X[-1]] else: res = longest(LCS(X, Y[:-1]), LCS(X[:-1], Y)) memo[(X, Y)] = res return res def longest(X, Y): return X if len(X) > len(Y) else Y start = time() print("".join(LCS("arnold schwarzenegger", "anol chuarcheneger"))) print("Time elapsed: %.4fs" % (time() - start))
Trovare la differenza