Lecture notes for Week 2: Recursion
Topics
-
MergeSort Analysis (continued).
-
Lab remarks.
-
Recursion.
Textbook portions covered
- Engineering Algorithms...(Clowes “online book”)
-
Chapter 2
Lecture 4 (Friday, 14 January 2005)
Announcements
-
Lecture notes now available.
Remarks on Lab 1
-
Good: In Lab 1 many students are trying to implement mySort(...) themselves (instead of “cutting and pasting” some C implementation they found).
-
Bad: Alas, some are coding mySort(...) directly with no abstract algorithm clearly identified.
-
Remarks: Recall that:
-
ELE428 is fundamentally a theory course.
-
Analysis of MergeSort (continued)
Lectures 5/6 (Tuesday, 18 January 2005)
Announcements
-
NONE
Introduction to Recursion
Covered most of Chapter 2 in Engineering Algorithms...(Clowes “online book”); i.e.:
- What is recursion? (divide and conquer)
- Addition example (add with counting and no loops)
- How it works
- Tail recursion
- Example: Fibonacci numbers
- Example: Towers of Hanoi
- Example: Counting ways to make change
Suggested Problems
- Engineering Algorithms...(Clowes “online book”)
-
- 2.2
- 2.3
- 2.4
- 2.5
- 2.10
- 2.12
- 2.16
- 2.20
by Ken Clowes
v1.0