The Gateway to Computer Science Excellence

0 votes

Link to the question - https://gateoverflow.in/20611/tifr2011-b-30

Someone please simplify that question and explain.

+3 votes

Best answer

Ok so we start with small array of size n = 3

Let the array A looks like:-

3 | 1 | 2 |

and Let array B is empty:-

Now in the question, it is given that we will be going to fill the array B with the following equation i.e.

**B[A[i]] = i / for all i and i = 1,2,3**

Now consider the following table to fill the array B

i |
A[i] |
B[A[i] = i |
View of Array B |

1 | 3 | B[3] = 1 | {_ , _ , 1} |

2 | 1 | B[1] = 2 | {2 , _ , 1} |

3 | 2 | B[2] = 3 | {2 , 3 , 1} |

now after that array B will look like this-

2 | 3 | 1 |

you can see that this is also an permutation ( or another way of arranging the elements) of the elements 1,2,3.

Or in other words, you can say that it is a permutation of array A.

**Hence answer is Option B)**

Hope this helps ...

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.3k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.5k
- Others 1.5k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,645 questions

56,542 answers

195,693 comments

101,538 users