COIS 2240H Lecture Notes - Lecture 3: Mathematical Induction
Document Summary
Recursion: a recursive method is a method that calls itself. Recursive functions: two main components are required for every recursive function, the first, the base call, returns a value without making any subsequent recursive call. The second main component od a recursive function is: the reduction step. Recursion in math: the equivalent to recursive programming in math is mathematical induction (weak) Talking about things in the abstract is very difficult. Iteration: many different functions that could be implemented using recursion can also be implemented using iteration. Iteration is the process of repeating an instruction until a condition is met. For loop: most popular loop we can utilize in order to iterate. In certain instances the execution time will be so low that you cannot measure it in seconds. Timing in java: measusirng execution time can be tricky, we need to import a class in order to be able to use timing tools.