From 98cef5e9a772602d42acfcf233838c760424db9a Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Thu, 13 Feb 2025 18:00:17 +1100 Subject: initial commit --- comp6771/1/src/word_ladder.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 comp6771/1/src/word_ladder.h (limited to 'comp6771/1/src/word_ladder.h') 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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; + +// 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& lexicon) + -> std::vector>; +} // namespace word_ladder + +#endif // COMP6771_WORD_LADDER_H -- cgit v1.2.3