[algogeeks] Re: Pyramid algorithm?

2009-01-20 Thread Coskun Gunduz
you're right, the definition is "Say you have a collection of stackable objects, like blocks or boxes. You need to stack them in a pyramid as tall as possible, so that no more than 1-2 of the objects is at the top level, and so that each layer is *larger than the first*," probably it should be *l

[algogeeks] Re: Pyramid algorithm?

2009-01-19 Thread Coskun Gunduz
hey almost the same LOL. you type faster than me :) On Mon, Jan 19, 2009 at 5:01 PM, Karthik Singaram Lakshmanan < karthiksinga...@gmail.com> wrote: > > Well. I would suggest the following. > If n is the number of stackable objects, > You could compute the largest value of x such that x*(x+1)/2 <

[algogeeks] Re: Pyramid algorithm?

2009-01-19 Thread Coskun Gunduz
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,...

[algogeeks] Re: Pyramid algorithm?

2009-01-19 Thread Coskun Gunduz
1 2 4 I guess. coskun... On Mon, Jan 19, 2009 at 2:29 PM, manoj janoti wrote: > Just want to know what will be the structure if the number of stackable > objects is 7 > > ~Janoti > > > On Mon, Jan 19, 2009 at 11:17 AM, Darth Continent < > darthcontin...@gmail.com> wrote: > >> >> Hello, when I

[algogeeks] Re: Seeking an answer for a question from a test in algo

2008-09-17 Thread Coskun Gunduz
root vertex). Maybe you can delete each vertex v > when you scan each edge (u, v) but that doesn't seem right. > > If I'll get the solution I'll make sure to share it with you guys, > > Alex > > On Sep 17, 9:04 am, "Coskun Gunduz" <[EMAIL PROTECTE

[algogeeks] Re: Seeking an answer for a question from a test in algo

2008-09-16 Thread Coskun Gunduz
Hi, If I'm not wrong, you don't have to find a root node. You only need to check if a given node u is root or not. Actually O(E) seems too low to me for this. I think this problem can be solved in O(E) if it's been reduced to some other problems. I tried using prime factors, but couldn't make it

[algogeeks] Re: Permutations of combinatorial choices

2008-09-13 Thread Coskun Gunduz
Hi, try to see the problem in a different way; choosing 3 students from a group of 7. This is a simpler point of view. Then let the other 4 students make another group of size 4. I recommend Revolving Door algorithm to find C(7,3), which is covered at Knuth's TAOCP pre-fascicle 3a. There are also