Never trust modern technology. Trust it only when it is old technology.


Algorithms

For the sudoku funs i have something interesting that came up into my mailbox this morning. First of all , we have to define What algorithm is .

An algorithm is a sequence of steps to be followed to accomplish a certain task. Often used in computer programming, they can become interesting puzzles because even though there can be many ways to accomplish something, one may be better than another.

Ok here is the quiz of the day . Dont feel sad when you are not able to think a solution. Its tricky and i have not solve it yet. But please feel happy to find the solution .


At a party with N people, each person is identified by a unique number between 1 and N. Each person is also wearing a hat with their number on it. They decide to play a game. Each person passes his or her hat to the person with the next highest number (so person 2 gets hat 1, person 3 gets hat 2, and person 1 gets hat N). The game proceeds from there in rounds; on each round, each person may choose to either keep the hat they currently have, or swap hats with exactly one other person.


What is the minimum number of rounds, as a function of N, that it would take for every person to get their own hat back? Note: each person can see their own hat at any time.

2 Responses to “Algorithms”

  1. # Anonymous Anonymous

    { 0, n }  

  2. # Blogger ThinkaGeek

    hmm let me check it  

Post a Comment

Search



XML