Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Exercise 2b: Hitman recursion

Given a predicate is_insulting_price, write a recursive function which determines the minimum amount for which a target may be killed without risk of the plot being exposed to the police by an individual receiving a lowball offer. The function will be passed an arbitrarily high value, and should recursively call itself with (1 - epsilon) * price whenever is_insulting_price returns false.

For bonus marks, quantify the tradeoff between error range and stack depth, the latter representing the number of people who need to know about the plot.



Great comment - I came here to brainstorm how this could be turned into an exam question and you beat me to it.


Stack overflow...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: