On Jun 1, 2:27 pm, Raj N <rajn...@gmail.com> wrote: > How to implement 3 stacks using the same? > > On Tue, Jun 1, 2010 at 8:59 PM, Sudarshan Reddy M > <sudarsha...@gmail.com>wrote: > > > > > Hi, > > the stacks can implemented in the array one is starting at the begin and > > other is starting at the end growing in opposite directions. If the stack > > tops are colloid then there is no space left; means no room for extra > > elemnts. > > Thanks > > Sudarshan. > > > On Tue, Jun 1, 2010 at 2:11 PM, Raj N <rajn...@gmail.com> wrote: > > >> Hi all, > >> Can someone suggest me an efficient way to implement 2 stacks within a > >> single linear array assuming neither of the stack overflows and an > >> entire stack is never shifted to a different location within the array. >
Interleave them. If you need N stacks, use A(i), A(i+N), A(i+2N) ... for the i'th stack. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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?hl=en.