Radix Sort, Dynamic Programming - Design and Analysis - Study Notes, Study notes of Digital Systems Design

Radix Sort, Dynamic Programming, Fibonacci Sequence, Original recursive algorithm, Dynamic programming algorithm, Memoization, Recursive calls during computation of Fibonacci number are the key points in this study notes file.

Typology: Study notes

2011/2012

Uploaded on 11/03/2012

ankitay
ankitay 🇮🇳

4.4

(50)

106 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture No.16
5.3 Radix Sort
The main shortcoming of counting sort is that it is useful for small integers, i.e., 1..k
where k is small. If k were a million or more, the size of the rank array would also be a
million. Radix sort provides a nice work around this limitation by sorting numbers one
digit at a time.
Here is the algorithm that sorts A[1..n] where each number is d digits long.
Dynamic Programming
6.1 Fibonacci Sequence
Suppose we put a pair of rabbits in a place surrounded on all sides by a wall. How many
pairs of rabbits can be produced from that pair in a year if it is supposed that every month
each pair begets a new pair which from the second month on becomes productive?
Resulting sequence is 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, . . . where each number is the
sum of the two preceding numbers.
This problem was posed by Leonardo Pisano, better known by his nickname Fibonacci
(son of Bonacci, born 1170, died 1250). This problem and many others were in posed in
his book Liber abaci, published in 1202. The book was based on the arithmetic and
algebra that Fibonacci had accumulated during his travels. The book, which went on to be
widely copied and imitated, introduced the Hindu-Arabic place-valued decimal system
and the use of Arabic numerals into Europe. The rabbits problem in the third section of
Liber abaci led to the introduction of the Fibonacci numbers and the Fibonacci sequence
for which Fibonacci is best remembered today.
Docsity.com
pf3

Partial preview of the text

Download Radix Sort, Dynamic Programming - Design and Analysis - Study Notes and more Study notes Digital Systems Design in PDF only on Docsity!

Lecture No.

5.3 Radix Sort

The main shortcoming of counting sort is that it is useful for small integers, i.e., 1..k where k is small. If k were a million or more, the size of the rank array would also be a million. Radix sort provides a nice work around this limitation by sorting numbers one digit at a time.

Here is the algorithm that sorts A[1..n] where each number is d digits long.

Dynamic Programming

6.1 Fibonacci Sequence

Suppose we put a pair of rabbits in a place surrounded on all sides by a wall. How many pairs of rabbits can be produced from that pair in a year if it is supposed that every month each pair begets a new pair which from the second month on becomes productive? Resulting sequence is 1, 1, 2, 3, 5, 8, 13, 21, 34, 55,... where each number is the sum of the two preceding numbers.

This problem was posed by Leonardo Pisano, better known by his nickname Fibonacci (son of Bonacci, born 1170, died 1250). This problem and many others were in posed in his book Liber abaci , published in 1202. The book was based on the arithmetic and algebra that Fibonacci had accumulated during his travels. The book, which went on to be widely copied and imitated, introduced the Hindu-Arabic place-valued decimal system and the use of Arabic numerals into Europe. The rabbits problem in the third section of Liber abaci led to the introduction of the Fibonacci numbers and the Fibonacci sequence for which Fibonacci is best remembered today.

This sequence, in which each number is the sum of the two preceding numbers, has proved extremely fruitful and appears in many different areas of mathematics and science. The Fibonacci Quarterly is a modern journal devoted to studying mathematics related to this sequence. The Fibonacci numbers Fn are defined as follows:

F 0 = 0 F 1 = 1 Fn = Fn-1 + Fn-

The recursive definition of Fibonacci numbers gives us a recursive algorithm for computing them:

Figure ?? shows four levels of recursion for the call fib(8):

Figure 6.1: Recursive calls during computation of Fibonacci number

A single recursive call to fib(n) results in one recursive call to fib(n - 1), two recursive calls to fib(n - 2), three recursive calls to fib(n - 3), five recursive calls to fib(n - 4) and, in general, Fk-1 recursive calls to fib(n - k) For each call, we’re recomputing the same fibonacci number from scratch. We can avoid this unnecessary repetitions by writing down the results of recursive calls and looking them up again if we need them later. This process is called memoization. Here is the algorithm with memoization.