EXAMPLE, BREADTH FIRST (queue - add to the end of the list, remove from the front of the list) These operations are often called enqueue and dequeue.
NOTE THAT THE POSSIBLE PATH LISTS ARE EACH CONSTRUCTED IN REVERSE ORDER IN THESE EXAMPLES..."cat" --> "bat" is represented as ["bat", "cat"]
[["bat", "cat"], ["cab", "cat"], ["cam", "cat"], ["can", "cat"], ["cap", "cat"], ["car", "cat"], ["caw", "cat"], ["cot", "cat"], ["cut", "cat"], ["eat", "cat"], ["fat", "cat"], ["hat", "cat"], ["mat", "cat"], ["oat", "cat"], ["pat", "cat"], ["rat", "cat"], ["sat", "cat"], ["vat", "cat"]]
"bat"--> "bad", "bag", "bah", "ban", "bar", "bay", "bet", "bit", "but", "eat", etc
[["bad", "bat", "cat"], ["bag", "bat", "cat"], ["bah", "bat", "cat"], ["ban", "bat", "cat"], ["bar", "bat", "cat"], ["bay", "bat", "cat"], ["bet", "bat", "cat"], ["bit", "bat", "cat"], ["but", "bat", "cat"], ["eat", "bat", "cat"], ["fat", "bat", "cat"], ["hat", "bat", "cat"], ["mat", "bat", "cat"], ["oat", "bat", "cat"], ["pat", "bat", "cat"], ["rat", "bat", "cat"], ["sat", "bat", "cat"], ["vat", "bat", "cat"]]
[["cab", "cat"], ["cam", "cat"], ["can", "cat"], ["cap", "cat"], ["car", "cat"], ["caw", "cat"], ["cot", "cat"], ["cut", "cat"], ["eat", "cat"], ["fat", "cat"], ["hat", "cat"], ["mat", "cat"], ["oat", "cat"], ["pat", "cat"], ["rat", "cat"], ["sat", "cat"], ["vat", "cat"], ["bad", "bat", "cat"], ["bag", "bat", "cat"], ["bah", "bat", "cat"], ["ban", "bat", "cat"], ["bar", "bat", "cat"], ["bay", "bat", "cat"], ["bet", "bat", "cat"], ["bit", "bat", "cat"], ["but", "bat", "cat"], ["eat", "bat", "cat"], ["fat", "bat", "cat"], ["hat", "bat", "cat"], ["mat", "bat", "cat"], ["oat", "bat", "cat"], ["pat", "bat", "cat"], ["rat", "bat", "cat"], ["sat", "bat", "cat"], ["vat", "bat", "cat"]]
EXAMPLE, DEPTH FIRST: stack - add to the top (front) of the stack, remove from the top of the stack. These operations are often called push and pop.
Find a path from "cat" to "bad".
[["bat", "cat"], ["cab", "cat"], ["cam", "cat"], ["can", "cat"], ["cap", "cat"], ["car", "cat"], ["caw", "cat"], ["cot", "cat"], ["cut", "cat"], ["eat", "cat"], ["fat", "cat"], ["hat", "cat"], ["mat", "cat"], ["oat", "cat"], ["pat", "cat"], ["rat", "cat"], ["sat", "cat"], ["vat", "cat"]]
"bat"--> "bad", "bag", "bah", "ban", "bar", "bay", "bet", "bit", "but", "eat", etc
[["bad", "bat", "cat"], ["bag", "bat", "cat"], ["bah", "bat", "cat"], ["ban", "bat", "cat"], ["bar", "bat", "cat"], ["bay", "bat", "cat"], ["bet", "bat", "cat"], ["bit", "bat", "cat"], ["but", "bat", "cat"], ["eat", "bat", "cat"], ["fat", "bat", "cat"], ["hat", "bat", "cat"], ["mat", "bat", "cat"], ["oat", "bat", "cat"], ["pat", "bat", "cat"], ["rat", "bat", "cat"], ["sat", "bat", "cat"], ["vat", "bat", "cat"], ["cab", "cat"], ["cam", "cat"], ["can", "cat"], ["cap", "cat"], ["car", "cat"], ["caw", "cat"], ["cot", "cat"], ["cut", "cat"], ["eat", "cat"], ["fat", "cat"], ["hat", "cat"], ["mat", "cat"], ["oat", "cat"], ["pat", "cat"], ["rat", "cat"], ["sat", "cat"], ["vat", "cat"]]