According to the instructions, the function has_match should return a boolean value, True or False. But after looking on the find_longest function, it seems like has_match is treated like it returns the match itself. For an example, you check if "match != None", but it is never None, it is always True or False resulting an endless loop / error in one of the utility functions because of the unexpected input (Empty fingers raised an error for me)
Also, according to the question, we are searching for the longest substring, but it seems like find_longest returns the length of the longest substring and not the substring itself.
Or maybe I simply misunderstood the instructions somewhere?
im not sure if I misunderstood or there is still a mistake in Q2.
has_match return just one substring and not all of them. but in delth section we asked to writh all the substring with max length.
but find_longest print just one.
should I change it to print all the substring with max length, or just find by my own the all substring with max length for the pdf file and keep find_longest how it is?
(has_match return just one substring,should i cahnge it too ? )
find_longest returns the length of the longest common substring of text1 and text2.
Use this value to print all the maximal length common substrings.
You can write your own simple function that does that.
Note that you should not submit the code you used for solving 2(d) as part of your .py file. Just add the common susbtrings of maximal length to your pdf file.
in make_hashtable, what should be returned if there is no fingerprint of a certain value?
For example: make_hashtable([0,0,1,2,1,2,1,2,3,3,3,0,0], 5) does not contain 4.
Should it be: [[0, 1, 11, 12], [2, 4, 6], [3, 5, 7], [8, 9, 10], None]
or maybe: [[0, 1, 11, 12], [2, 4, 6], [3, 5, 7], [8, 9, 10], ]
Does it matter?
In section Dalet you required to find all the common substrings with maximum length. The function has_match does not do that, the returned value is only one common substring (first one?)
So , should the change in the code to show all the common substrings be included in the py file, or just change the implementation for the purpose of this section but not include it?
You should not add the code for 2(d) to the .py file you submit.
You can wither change the implementation for this section only and NOT incude it
Use the maximum length you found to find all common substrings of this length (it can be done using a very simple code)
In any case - so not submit the code for this section.
My code found only one long common substring with a length much more than 20. Is there anything worng in it?
There is no sample for has_match output, so just for clarification - when you refer to "common substring", you refer to common substring located anywhere in the strings, or that the common substring must be located in the exact same location in the strings?
For example, considering the two strings "abc" and "bcd", is "bc" a match?
In question 2a, are we suppose to use the "length" from the input?
For fingerprint(t-1) the function checks fingerprint(t) anyway, so the fingerprint calculated is for a string one char longer than the one calculated before. why does the length matter?
Look at the guidelines on how to implement the function. This function should return a common substring of length t if there is a match otherwise it returns none. You must know the "length" t in order to return such substring.