In class, we're learning about recursive functions. One example given was figuring out 1 + 2 + 3+ 4 + 5 + 6 + 7 + 8 + 9 + 10. My professor stated to address this, we start with 10 in the function and decrement for the next recursive call, so 10 + f(9). He said going the other way would be considered more work, 1 + f(2), and a recursive function should do the least amount of work possible. I don't get why this is considered more work. It would be the same number of steps either way. What's the benefit of counting down instead of up in terms of the workload? Thanks.(adsbygoogle = window.adsbygoogle || []).push({});

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Units of work using recursion

Loading...

Similar Threads for Units using recursion |
---|

C/++/# Is it possible to make graphs using C++? |

JavaScript Problem using dat.GUI controller library |

Using Visual Basic |

C/++/# How to use C++ in studying calculus |

Is assembly language still being used? |

**Physics Forums | Science Articles, Homework Help, Discussion**