Last active
March 9, 2016 03:46
-
-
Save quangnle/68735d8fa0bafcd10c64 to your computer and use it in GitHub Desktop.
masked matching direct recursive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec directmatch (s:string) (d:string) (i:int) (j:int) (prev:int) = | |
if i = s.Length then true | |
else | |
if s.[i] = '*' then directmatch s d (i + 1) j i | |
else | |
if j < d.Length then | |
if s.[i] = d.[j] then directmatch s d (i + 1) (j + 1) prev | |
else directmatch s d (prev + 1) (j - i + prev + 2) prev | |
else false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment