@subrat : its number of floors the lift moved .. its actually the distance
lift travelled ...
Ex: 312 --> person1 has to go to floor 3 --> lift has to move 2 floors -->
count will be 2.
On Sun, Jun 2, 2013 at 1:04 PM, subrat kumar prasad <iitr.s...@gmail.com>wrote:

> @bharat: how do u count lift movement? Is it taking a person from any
> random floor to any random floor as 1 count or the number of floor it goes
> through to drop a person.
> for example : if 3 1 2 is the given input. Here person 1 wants to go to
> floor 3. Taking him to its respective floor counts 1 or 2 ?
>
>
> On Sun, Jun 2, 2013 at 11:51 AM, bharat b <bagana.bharatku...@gmail.com>wrote:
>
>> @Piyush : Yes this is sorting problem .. but we have to consider many
>> things while sorting ..
>> First : if we sort the way u said, can u guarantee that it gives u
>> optimum value(min number of lift movements).
>> Second : This is not pure array problem... As the problem stated... we
>> can keep more than one person in a single floor at one point of time...
>> which can't be done in a plain array...
>> Third : We have to consider the position of lift also ...
>>
>>
>> On Fri, May 31, 2013 at 12:36 PM, Piyush Grover <
>> piyush4u.iit...@gmail.com> wrote:
>>
>>> The problem is an array sorting problem.
>>> You are given an array of size N containing values 1 to N only. Sort it
>>> in O(N).
>>>
>>> Start from floor 1 till ith floor until you find a person on the wrong
>>> floor, take him to his respective floor
>>> take the guy from that floor and take him to his respective floor do it
>>> until you reach back to ith floor.
>>> Keep a counter, if all the N persons have been moved you are done
>>> otherwise repeat the procedure
>>> starting from i+1 th floor.
>>>
>>>
>>>
>>>
>>> On Fri, May 31, 2013 at 11:51 AM, bharat b <bagana.bharatku...@gmail.com
>>> > wrote:
>>>
>>>> There are N floors and N persons each one is tagged with some random
>>>> unique number between 1 to N(represents floor number).
>>>> We have a lift which can accommodate one person at a time. Every person
>>>> is in some random floor.
>>>> Initially lift is at floor 1 and all floors have single person. Problem
>>>> here is.. we have to move the persons to their corresponding floor with
>>>> minimum number of lift movements.
>>>> Restriction : Lift can have at most one person at a time.
>>>> While moving persons, at some point of time, we can keep more than one
>>>> person at one floor.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to algogeeks+unsubscr...@googlegroups.com.
>>>>
>>>>
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to algogeeks+unsubscr...@googlegroups.com.
>>>
>>>
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to algogeeks+unsubscr...@googlegroups.com.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


Reply via email to