Exemplo n.º 1
0
def generateChildren(wordNodeFather):
    tree = Bintree()
    father = wordNodeFather.getWord()
    for i in range(0, len(father)):  #for every letter in father
        for j in range(0, len(letters)):
            possibleWord = father[:i] + letters[j] + father[i + 1:]
            if wordTree.exists(possibleWord) and not possibleWord == father:
                tree.put(WordNode(wordNodeFather, possibleWord))
    return tree.getTree()