Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
behdad
· 3y ago · 0 comments
Consider the string "thereis", and the dictionary {"there", "is"}. The greedy algorithm fails.
Comments
[–]
behdad
OP
3y ago
My bad. The dictionary should be {"the", "there", "is"}.
[–]
whiddershins
3y ago
I am now getting that I didn’t understand what you meant by greedy.
[–]
ttoinou
3y ago
Oh yeah makes sense, if we don't do that the greedy way we could simply continue the search if it hasn't been found. That's what I would have done