Aliabbas Petiwala wrote:
> N -ROOM LIGHTS PROBLEM
>
> ========================
>
>
>
> THERE IS A BIG SQURE ROOM OF SIDE N WHICH CONSISTS OF N X N SMALLER SQUARE
> ROOMS(ARRANGED LIKE  CHESS BOARD)
>
> EACH  ROOM HAS A LIGHT.
>
> WHEN the light of a  smaller room k  is toggled then all the neighboring
> room's lights get toggled (max 5 lights get toggled including the kth   room
> )
>
> THE PROBLEM IS to formulate an algorithm which will generate an order in
> which the lights have to be toggled such that
> all the n X n rooms get lit, initially no room is  lit.

Toggle seems to be used in two different ways.  Let me restate the
problem as each room has a switch (Up or Down), and a light (On or
Off).  A light is On iff the number of Up switches in the room and its
horizontal/vertical (not diagonal) neighbors is odd.

It seems like you can find a solution (when there are any) in O(N^3)
time by converting this to a linear system of equations, and then
solving the system.  Details are left to the reader.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to