OK, here's my algorithm:

Let n be the number of stacks.

start from 1 and begin making the levels, stop at m where n-((m-1)*m/2)<=m.
Put the stacks left to the level m-1.

here's the idea: number of stacks for each level is, starting from 1 and
increase by 1 at each step. So, it goes as, 1,2,3,...

Somewhere, the stacks left in your hand will be less than or equal to the
number of stacks required for that level. Then put those stacks to the level
above.


for 7:
1
2
3

now there's 1 stack left. and 1 2 3 1 is not allowed. Then add the 1 stack
left to level 3. That makes

1
2
4

Well, my algorithm always puts 1 stack to the top level. Maybe someone else
can find a better one by checking both 1 and 2 at the beginning and choose
the better one.

best,

coskun...


On Mon, Jan 19, 2009 at 4:39 PM, Darth Continent
<darthcontin...@gmail.com>wrote:

>
> Are you on something...?  Not on TO something but ON something??
>
> No more than 1-2 of the objects at the TOP level, and each layer is
> LARGER than the first.
>
>
>
> On Jan 19, 7:16 am, "Miroslav Balaz" <gpsla...@googlemail.com> wrote:
> > LOL, according to your definition , pyramid would look like this
> > o
> > oo
> > oo
> > oo
> > oo
> > oo
> > oo
> > oo
> > oo
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 
algogeeks+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to