<< Previous exercise (4.36)
| Index |
Next exercise (4.38) >>
yes. Ben's solution is more efficient. It ignored many irrelevant solutions. because it doesn't need to enumerate k from j to high.
I think it's different.
When the range from low to high is not large, ex4.35 method will work faster, because sqrt and integer? are not fast.
When the range from low to high is large, ex4.37 method will work faster, because it ignored many irrelevant solutions.