Material Detail

Lecture 20: Car-Cdr Recursion Problem that Returns the Sum of Every Element in a List of Integers

Lecture 20: Car-Cdr Recursion Problem that Returns the Sum of Every Element in a List of Integers

This video was recorded at Stanford Engineering Everywhere CS107 - Programming Paradigms. Okay, if I want to go ahead and do something like this, I want it to come back with a zero. And so, what I'm going to exploit here is – I think it's something that's pretty conceptually obvious to everyone – is that the sum of this entire list is gonna be 1 plus whatever the sum of this list is. I'm gonna exploit the fact that cuda is available to me, and it's very, very fast to just kind of recurse on the tail of the list. For the implementation, is this right here. If it is the case that null of num list passes, or comes back with a true, then it evaluates this expression. ... See the whole transcript at Programming Paradigms - Lecture 20

Quality

  • User Rating
  • Comments
  • Learning Exercises
  • Bookmark Collections
  • Course ePortfolios
  • Accessibility Info

More about this material

Comments

Log in to participate in the discussions or sign up if you are not already a MERLOT member.