You are on page 1of 2


The recursive way of solving a problem is to reduce the problem into another problem
that is exactly of the same type, and solving the new one instead. One of the examples which
I have used to understand the recursion relation is the following:
Let's assume X has moved to a new accommodation. He is exploring the neighbourhood, and
X suddenly discovers that he does not know his house number. He looked at the building and
could not find a number there. X knocked on a random apartment, and asked, "What is the
number of this building," and Y opened the door and said, "I don't know the number of this
building, but if you look at the number of the building next to us and add 1, you will know
our building number."
Now the actual problem gets decomposed. The problem X was trying to solve deal with
“knowing the number of his house." Now this scenario gives a projected solution to this
problem. The suggestion given by Y was that X should look at the number of the building
next to him and add 1. X’s problem was thus reduced into a problem of exactly the same
nature! At first X’s problem was "to find the number of a house," and X’s problem now
became "finding the number of a house."
If again the next door person, Z says "I don't know the number of this building, but if you
look at the number of the building next to us and add 1, you will know our building number",
X should repeat this again and again, till he finds a house with a number he knows. He will
add 1, and know the number of the one next to it, and so on, until he reaches his house.
DQ2. Principle of recursion suggests of the idea of decomposing a long task into several
small parts. A very simple example of this is doing the dishes. Instead of cleaning all the
dishes together we clean the dishes one by one which aggregates to the whole task of
cleaning the dishes. Due to the fact that there is finite number of dishes, it is possible to track
till the end of the task.

one could try bucket/radix sort algorithm. one way functions. and go over the n integers. Also. For a simple example. etc. OWF. For an example. Comparison based sorting algorithms share a lower bound of O(nlogn). suppose one has n integers to be sorted. To achieve O(n). there is a formal term for this. in mathematics. 1000]. if the integer is equal to 500. are those functions that are easy to solve in one direction but hard to invert. all of which belong to the interval [1. Another set of mathematical functions. Finally he can concatenate all the buckets to obtain the sorted list. In that case. This algorithm takes O(n) . A one-way function is a function that is easy to compute and hard to invert. Easy is defined as functions that can be computed in polynomial-time. it goes to bucket 500. the input must have prior knowledge or bear additional properties.DQ3. DQ4. we can't use any comparison based algorithms. and hard defined as functions not computable in polynomial time. small integers mean that the integers fall within a specified range. It is a cliché that most things are easier to do than to undo. He has just to make 1000 buckets. which does not require any comparisons.