Algorithm/firstfit: naive implementation