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

What is the complexity of this program.? Here is it: prefixes = "JKLMNOPQ" suffix = "uack" def comp(x): for letter in prefixes: print letter + suffix comp(prefixes)

OpenStudy (e.mccormick):

Well, I see a problem with suffix = "ack" No u.

OpenStudy (anonymous):

You can either modify the loop or the prefixes variable, I'd suggest the latter. Maybe you can separate the prefixes in a way that Q and O both have a 'u' attached to them.

OpenStudy (mandre):

Using Big-O notation it looks like O(n) to me, but I must admit I need to review complexity again. I'm a bit out of practice.

OpenStudy (anonymous):

Its O(len(prefixes))

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!