Start the first stack from the starting of the array and the second array from the end as shown below
--------> <-------- -------------------------------------------------------------------------- 0 n now for underflow condition will be stack 1 if (top1 == 0) stack 2 if (top2 == n) and overflow condition will be if (top2-top1+1 == 0) thats it.... correct me if anything wrong On Tue, Jun 1, 2010 at 2:11 PM, Raj N <[email protected]> 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. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Regards Jitendra Kushwaha Undergradute Student Computer Science & Eng. MNNIT, Allahabad -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
