CMPT 225 Lecture Notes - Lecture 4: Short Circuit, Binary Search Algorithm, Doubly Linked List
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)