CMPT 225 Lecture Notes - Lecture 4: Short Circuit, Binary Search Algorithm, Doubly Linked List

40 views2 pages

Document Summary

Recursive call is last statement of algorithm. Also passing along result so far (essentially), final result of recursive call is final result of the function. Just says return the result of calling the factorial function - no multiplying it by anything, for example. Build up answer as you go down through recursive calls, rather than up. In fact, even done automatically by some compilers. Recursion can still be used as a problem solving technique even if you don"t implement with recursion in the end. Recursion trees can be used to trace through recursive calls. Can use induction to prove your recursive solution before you implement it. Linked lists are recursive data structures - defined in terms of themselves. Useful for reference structures if (front == null || s < front->data) { } If the first is true, don"t bother making the second comparison (because or is already true)

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