[Q] Most efficient approach to split a string into words

Правка en1, от Bliss8, 2017-07-18 02:09:36

question example:
given a string "aaaabbbasd" and dictionary, for example {a, aa, aaa, b, bb, s, d}
1) find one possible way to split the string into words from dictionary
2) find all possible ways to split the string into words from dictionary

Searching for the best approach on web I found different ones: dp, backtracking + memorization, dfs + memorization.
I lost in all of this huge variety.
Does somebody knows what approach is the best here?

Теги word, break, split

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Bliss8 2017-07-18 02:12:27 1 Tiny change: 'ebody knows what appr' -> 'ebody know what appr'
en1 Английский Bliss8 2017-07-18 02:09:36 530 Initial revision (published)