for three stacks u can use indices 0 3 6 etc for stack1. 1 4 7 for stack 2
and 2 5 8 etc for stack 3.
now if any of the stack overflows but there is still space in array as other
stacks have few element then now u can grow ur stack in reverse direction as
shown below :
indices of array : 0
three or more stacks can be made by using linked array representation
--
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
@Raj N : You are right overflow is top2-(top1+1)==0
@Anand : The oveflow condition is dependent how underflow condition are
implemented. Considering underflow above condition for overflow suffice
For 3 stacks a efficient algo is not easy to think in a single array , yet
we can optimise
@Jitendra: Hey that condition for overflow is it not top2-(top1+1)==0
And how to implement 3 stacks using the same
On Tue, Jun 1, 2010 at 9:38 PM, Jitendra Kushwaha
jitendra.th...@gmail.comwrote:
Start the first stack from the starting of the array and the second array
from the end as shown
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
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
Start the first stack from the starting of the array and the second array
from the end as shown below
--
0
How to implement 3 stacks using the same?
On Tue, Jun 1, 2010 at 8:59 PM, Sudarshan Reddy M sudarsha...@gmail.comwrote:
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