Re: [algogeeks] 3 stacks using one array?

2011-06-03 Thread Harshal
@Sunny: yes, you are right. If any stack is allowed to grow as long as there is any free space in the array, we will have to allocate space to stacks sequentially in the array maintaining a pointer to the previous top element of a particular stack, and updating the new top. Thus any new element i

Re: [algogeeks] 3 stacks using one array?

2011-06-03 Thread sunny agrawal
@Harshal Your Solution is optimal but i think in this question whenever there is some space available in array we should be able to use that space for either of the stack. in your solution this thing is missing. I don't know the solution but i think it can be improved in a way to get the required

Re: [algogeeks] 3 stacks using one array?

2011-06-03 Thread Harshal
Divide the array into 3 equal parts and allow each stack to grow in its space (1/3 of total.) On Fri, Jun 3, 2011 at 11:54 AM, kumar vr wrote: > > Can you give an efficient way of implementing 3 stacks using a single > array? > > -- > You received this message because you are subscribed to the

[algogeeks] 3 stacks using one array?

2011-06-02 Thread kumar vr
Can you give an efficient way of implementing 3 stacks using a single array? -- 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 algo