For ProblemSet3 in Problem3, the constrainedMatchPair(...) function, am I just matching individual characters of secondMatch within firstMatch? or am I matching all subsets of characters of secondMatch within firstMatch? or am I not getting this problem?
Here is the link to the pdf if anyone wants to try and decipher what is needed. It would be nice if they provided sample input/output . I looked at it, but it was not immediately clear what it is supposed to do. http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset3.pdf
suppose your key is 'ABCD'. you break it into two substrings leaving one letter out - you make all combinations of this: key1 key2 '' 'BCD' 'A' 'CD' 'AB' 'D' 'ABC' '' using substringmathchexact with key1 and then with key 2 - you can get two tuples, one that contains starting indices of key1 and one for key2. for each index in the key1 tuple, you look to see if there is an index in the key2 tuple that satisfies the equation given in the instructions - if so, save the key 1 index, it is the starting point of a match with at most one substitution. For the key example given above, you would go thru this process 4 times, once for each key1/key2 combination. you are supposed to write a function (constrainedmatchpair()) that performs the tests on the key/key2 indices tuples and saves any key1 index that satisfies the equation. hope that made sense.
Join our real-time social learning platform and learn together with your friends!