mud13 - Lecture C13: Recurrence equations Response to...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture C13: Recurrence equations Response to 'Muddiest Part of the Lecture Cards' (40 respondents) 1) What does Recurrnece Equations got to do with programming? and similar questions (6 students) Recurrence equations provide a means of expressing the cost of an algorithm as a function of the size of the input. For example, with the Towers of Hanoi problem, moving 4 disks from tower 1 to tower 3 can be broken down into: Moving 3 disks from tower 1 to tower 2 Moving 1 disk from tower 1 to tower 3 Moving 3 disks from tower 2 to tower 3. If the cost of solving n disks is T(n), from the above breakdown, we can express T(n) as: C when n = 1 T(n) = 2T(n-1) + c when n > 1 This above representation is called a recurrence equation with T(n = 1) being the base case. 2) What exactly does the cost of a procedure entail? What is the benefit of calculating the efficiency/ cost of a function? and similar questions (5 students) The cost of an algorithm can be measured in terms of memory usage, processor usage or a combination of the two. When you are trying to compare the efficiency of two or more algorithms, you want to be able to compute the cost of the problem as a function of the size of the problem. The two functions can
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

mud13 - Lecture C13: Recurrence equations Response to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online