This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import timeit | |
# Starting from a particular crouton in the salad, traverse down to all other croutons | |
def myDFS(salad,crouton,length,paths,path=[]): | |
if crouton in path: | |
return | |
path=path+[crouton] | |
if len(path)==length: | |
paths.append(path) | |
else: |