Re: [algogeeks] optimization problem - N floors , N persons. minimum number of lift movements to move all persons in their respective floors

2013-06-02 Thread bharat b
@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

Re: [algogeeks] Infinite stream , identify distinct k kintegers

2013-06-02 Thread Avi Dullu
(For very large k case only) Keep as many elements in the hash_map as you can. Once the map capacity is exhausted, sort all the elements in the hash_map and write them to disk and build a bloom filter. Keep this bloom filterhttp://en.wikipedia.org/wiki/Bloom_filterin memory, empty the hash_map

Re: [algogeeks] optimization problem - N floors , N persons. minimum number of lift movements to move all persons in their respective floors

2013-06-02 Thread subrat kumar prasad
@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

Re: [algogeeks] optimization problem - N floors , N persons. minimum number of lift movements to move all persons in their respective floors

2013-06-02 Thread bharat b
@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.comwrote: @bharat: how do u count lift