Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 9 Online
OpenStudy (anonymous):

Pset3 Problem 3 I don't understand what the code is supposed to do? Can someone please explain in simpler terms?

OpenStudy (anonymous):

I made the program without really knowing in full how the code works. I understand what the outputs should be and how to get em to output but I don't understand why the outputs are what they are.

OpenStudy (shriram):

on the last page of the link you posted, , it talks about substitution or finding matches, does that help in understanding the use of the output?

OpenStudy (anonymous):

This is what I did http://dpaste.com/hold/528512/. Its kind of hard to explain I understand the syntax of how the program works but I guess what I don't understand is the mathematics on how the n+m+1==k gives you possible solutions

OpenStudy (anonymous):

sorry forgot to say in my program its if n+length+1==k but yea thats the part I don't understand.

OpenStudy (shriram):

i'm looking at it now. one sec

OpenStudy (shriram):

i'm starting to think that n+m+1=k might not be true for all possible situations especially empty string and "blah blah.. " case

OpenStudy (anonymous):

but thats what it said to do in the pset directions. Can you explain what it actually does to me because I only put it in because thats what the directions said I have no clue what it means.

OpenStudy (shriram):

let's take the example 'a' and 'gc' 'a' is at index 5 , and 5+ (length of a)+ 1 gives 7 the index of gc in the target string or the large string " ATGACATGCA"

OpenStudy (shriram):

does this help any?

OpenStudy (shriram):

first tuple really is ( 0,3,5,9) and 0,3,9 don't satisfy the condition n+m+1 = k - > 0+1+1, 3+1+1, 9+1+1 -> 2,5,11 is not equal to 7 (index of gc in the target string)

OpenStudy (anonymous):

yes this somewhat helps how would I fix it so that it doesn't give wrong answers?

OpenStudy (shriram):

what part of n+m+1 = k doesn't help at the moment? what input gives you errors? is that input appropriate at all? Remember it says split the key string into two parts

OpenStudy (shriram):

i looked at the code in http://dpaste.com/hold/528512/ you can remove "count" from subStringMatchExact function

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!