If we have 100 values in the search area, how many tries will this algorithm need? If we have 100 values in the search area, how many comparisons will this algorithm need?

If we have 100 values in the search area, how many tries will this algorithm need?

If we have 100 values in the search area, how many comparisons will this algorithm need?

Write a function called dir_search to return a list of paths to a specified
filename within a specified directory.
• For example, if a particular directory called test has three copies of a file
named f1.txt in it, one directly in test, one in a subdirectory called d2, and one
in a subdirectory of a subdirectory, d1/d4, then the function call
dir_search(“test”, “f1.txt”) should return [“test/f1.txt”, “test/d2/f1.txt”,
“test/d1/d4/f1.txt”]
• The ”os” module has a function called listdir that returns a list of files and
subdirectories in a directory.
• The “os.path” module has a function called isfile that return True if the
parameter is a file (and not a directory).

DETAILED ASSIGNMENT

20200930052404lecture13

Powered by WordPress