Function malachite_base::strings::exhaustive::exhaustive_strings
source · pub fn exhaustive_strings() -> StringsFromCharVecs<ExhaustiveVecs<char, PrimitiveIntIncreasingRange<u64>, ExhaustiveChars>> ⓘ
Expand description
Generates all [String
]s.
The lengths of the output [String
]s grow logarithmically.
§Complexity per iteration
$T(i) = O(\log i)$
$M(i) = O(\log i)$
where $T$ is time and $M$ is additional memory.
§Examples
use itertools::Itertools;
use malachite_base::strings::exhaustive::exhaustive_strings;
let ss = exhaustive_strings().take(20).collect_vec();
assert_eq!(
ss.iter().map(String::as_str).collect_vec().as_slice(),
&[
"", "a", "b", "aaa", "c", "aa", "d", "aaaa", "e", "ab", "f", "aab", "g", "ba", "h",
"aaaaa", "i", "bb", "j", "aba"
]
);