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

Hi! could somebody please explain the bisection method as used in the answer for pset 1 c? http://dpaste.com/766781/ (or from the lecture http://dpaste.com/766784/) I get the concept, but not the idea of how t code it: what are the statements that will make it execute the bisection? what do lines 18-19 mean, for instance? feel a bit lost here...

OpenStudy (anonymous):

take a short example whose anwer u know and run each statement by yourself . u will get that idea. try it

OpenStudy (anonymous):

Bisection method is faster in the sense that each time an element is searched,the size of the search space is reduced to half. In your case the lowest amount is one twelfth of the total balance supposing each month same amount is deducted without incurring any interest The maximum value is the total balance(In that case you would end up paying the whole sum in the first month) Now each time you go through the while loop the balance (result from the inner for loop) is analyzed there would be three cases: 1. if the balance is equal to zero.you're done! we break from the loop 2.If the balance is greater than zero we search |dw:1341315220285:dw| by assigning the payment to the minpay value 3.Likewise if it is less than zero we search |dw:1341315411584:dw| by assigning payment to maxpay we continue doing the 2 steps until the we get balance equal to zero and then we break from the loop . Hope that explains it!

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!