aboutsummaryrefslogtreecommitdiff
path: root/comp6771/1/src/word_ladder.h
diff options
context:
space:
mode:
Diffstat (limited to 'comp6771/1/src/word_ladder.h')
-rw-r--r--comp6771/1/src/word_ladder.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/comp6771/1/src/word_ladder.h b/comp6771/1/src/word_ladder.h
new file mode 100644
index 0000000..ef0f04a
--- /dev/null
+++ b/comp6771/1/src/word_ladder.h
@@ -0,0 +1,31 @@
+#ifndef COMP6771_WORD_LADDER_H
+#define COMP6771_WORD_LADDER_H
+
+#include <algorithm>
+#include <filesystem>
+#include <fstream>
+#include <numeric>
+#include <queue>
+#include <sstream>
+#include <string>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+namespace word_ladder {
+// Given a file path to a newline-separated list of words...
+// Loads those words into an unordered set and returns it.
+auto read_lexicon(const std::string& path) -> std::unordered_set<std::string>;
+
+// Given a start word and destination word, returns all the shortest possible
+// paths from the start word to the destination, where each word in an
+// individual path is a valid word per the provided lexicon. Preconditions:
+// - from.size() == to.size()
+// - lexicon.contains(from)
+// - lexicon.contains(to)
+auto generate(const std::string& from, const std::string& to,
+ const std::unordered_set<std::string>& lexicon)
+ -> std::vector<std::vector<std::string>>;
+} // namespace word_ladder
+
+#endif // COMP6771_WORD_LADDER_H