reset password
Author Message
Amedrano
Posts: 80
Posted 16:52 Oct 13, 2015 |

Can anyone tell me why "naive-reverse" is inefficient vs. "my-reverse" in Lecture 3.  It's doing the exact same thing with less lines of code.

Jordanton
Posts: 12
Posted 17:10 Oct 13, 2015 |

Because in naive-reverse, every time you are calling naive-reverse recursively, it calls the append function repeatedly.  This is extremely inefficient.  On the other hand, my-reverse does not call the append function.  I hope it helps.  

Last edited by Jordanton at 17:11 Oct 13, 2015.
Amedrano
Posts: 80
Posted 17:11 Oct 13, 2015 |

yes thanks