Docsity

Understanding Mutual Recursion's Impact on Time-Space Trade Off, Study notes of Computer Science

Partial preview of the text

Download Understanding Mutual Recursion's Impact on Time-Space Trade Off and more Study notes Computer Science in PDF only on Docsity!

Recursion, Efficiency, and

the Time-Space Trade Off;

Mutual Recursion

Checkout Recursion2 project from SVN

 Exam 2, tomorrow, open-book, open notes

◦ Can start at 7:30am if you want extra time

 Key Topics:

o Cohesion

o Coupling

o Immutable Classes

o Side Effects

o static

o Scope

o Interfaces

o Polymorphism

o Event-based prog.:

o ActionListener

o MouseListener

o Inheritance

o Abstract classes

o Object-oriented design

o CRC Cards

o Recursion

 Always have a base case that doesn’t recurse

 Make sure recursive case always makes

progress, by solving a smaller problem

 You gotta believe

◦ Trust in the recursive solution

◦ Just consider one step at a time

 Why does recursive Fibonacci take so long?!?

 Can we fix it?

 A deep discovery of computer science

 In a wide variety of problems we can tune the

solution by varying the amount of storage

space used and the amount of computation

performed

 Studied by “Complexity Theorists”

 Used everyday by software engineers

Q

 Two or more methods that call each other

repeated

Q

 Hofstadter Female and Male Sequences:

 Questions:

◦ How often are the sequences different in the first

50 positions? first 500? first 5000?