Thursday, August 29, 2013

Load balancing

We have a set of task i={1, ..., n} and each one has a cost b_i, how can we assigned to m servers so that the load is balanced?

Sunday, August 25, 2013

Triangle and Ants

On a triangle, there are 3 ants what is the probability that they collide when they move

Saturday, August 24, 2013

Sunday, August 18, 2013

What is wrong with this code?

string FindAddr( list emps, string name )
{
  for( list::iterator i = emps.begin();
       i != emps.end();
       i++ )
  {
    if( *i == name )
    {
      return i->addr;
    }
  }
  return "";
}

Friday, August 16, 2013

generate strings

Write a program that generates from the string "abcdefghijklmnopqrstuvwxyz{" the following: a bcb cdedc defgfed efghihgfe fghijkjihgf ghijklmlkjihg hijklmnonmlkjih ijklmnopqponmlkji jklmnopqrsrqponmlkj klmnopqrstutsrqponmlk lmnopqrstuvwvutsrqponml mnopqrstuvwxyxwvutsrqponm nopqrstuvwxyz{zyxwvutsrqpon

Thursday, August 15, 2013

Sunday, August 4, 2013

Use a dictionary

Given a string like "thisisalongstringwithmisakenoten" and a dictionary of words, split the string so that the number of non matched words are minimized. Try to optimize the code

Saturday, August 3, 2013

Implement a smartpointer class

using templates in C++

Smartpointer s1(T * ptr)
Smartpointer s1(Smartpointer & s2)
and the assigment
s1=s2