March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
|
|
@ -10,12 +10,17 @@
|
|||
(hash-set! memo (cons xs ys) r)
|
||||
r)
|
||||
|
||||
(define (lcs sx sy)
|
||||
(define (lcs/list sx sy)
|
||||
(or (lookup sx sy)
|
||||
(store sx sy
|
||||
(match* (sx sy)
|
||||
[((cons x xs) (cons y ys))
|
||||
(if (equal? x y)
|
||||
(cons x (lcs xs ys))
|
||||
(longest (lcs sx ys) (lcs xs sy)))]
|
||||
(cons x (lcs/list xs ys))
|
||||
(longest (lcs/list sx ys) (lcs/list xs sy)))]
|
||||
[(_ _) '()]))))
|
||||
|
||||
(define (lcs sx sy)
|
||||
(list->string (lcs/list (string->list sx) (string->list sy))))
|
||||
|
||||
(lcs "thisisatest" "testing123testing")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue