CMPT 115 Lecture Notes - Lecture 11: Linked List, Memory Address

58 views14 pages
9 May 2016
School
Course
Professor

Document Summary

Notes written by michael horsch, mark eramian, ian mcquillan, lingling jin, and dmytro dyachuk. 2. 4 some hints and rules of thumb . Dispelling concerns about recursion: recursion is a form of repetition based on function calls, instead of loops, you may like loops better because you practice those more. Understanding relationships is what humans do best. Therefore, recursion is what humans do best. Recursion: de nitions that refer to themselves are said to be recursive , example: n! Recursive algorithms: recursive algorithms (or c functions) are those that call themselves, recall that each time a recursive call is made, that call gets its own copy of local variables. Return: returns n! if ( n = 0 ) then return 1 else return n * factorial(n-1) // returns n! assuming n >= 0 int factorial (int n) { if( n == 0 ) { return 1; else { return n * factorial(n-1);

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents