Ask your own question, for FREE!
Mathematics 91 Online
OpenStudy (anonymous):

Consider the following pseudocode function. function Crunch(x is in R) if x ≥ 100 then return x/100 else return x + Crunch(10 · x) (a) Compute Crunch(5). Crunch(5) =

OpenStudy (anonymous):

@e.mccormick

OpenStudy (anonymous):

(b) What happens if you try to compute Crunch(−23)? What does this suggest about an appropriate precondition for this function?

OpenStudy (zzr0ck3r):

crunch(5) since x is not >= 100 return x + Crunch(10 · x) = 5+crunch(10*5) = 5+crunch(50) crunch 50 will return 50+crunch(50*10) so we have 5+50+crunch(500) crunch 500 will return 500/100 = 5 so crunch(5) returns 5+50+5 = 60

OpenStudy (zzr0ck3r):

I think

OpenStudy (zzr0ck3r):

Crunch(−23) will always crunch a number <= 100 so it will go in infinite loop, thus x needs to be positive

OpenStudy (anonymous):

Consider the following pseudocode function. function Crunch(x is in R) if x ≥ 100 then return x/100 else return x + Crunch(10 · x) (a) Compute Crunch(5). Crunch(5) = |dw:1371433544740:dw|

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!
Latest Questions
GrezzyySista: WHO THINKS MEN SHOULD START COOKING INSTEAD OF WOMEN??
32 minutes ago 4 Replies 0 Medals
jayfrmdAO: what 100 to the power of 8
6 minutes ago 5 Replies 1 Medal
jayfrmdAO: how to hide a cops body?
1 hour ago 5 Replies 2 Medals
Thayes: Rate the song 1-10
1 hour ago 2 Replies 1 Medal
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!