Created
January 13, 2023 17:44
-
-
Save deleteman/a4e51f154bcc4c50b348c49c05b41305 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function getAllSortedSuffixes(w) { | |
let suffixes = [] | |
for(let i = 0; i < w.length; i++) { | |
suffixes.push(w.slice(i)) | |
} | |
return suffixes.sort() | |
} | |
let tree = {} | |
let root = ""; | |
let suffixes = getAllSortedSuffixes(word) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment