@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 according the usage. For example lets say out of 3 stack we know the growth of 2nd stack more closely and we know its variations boundary of 2nd stack more clearly than others two. In such case make stack 2 static giving it its particular location. For the rest two apply same as implementation of two stack | stack2 |-------->1st 3rd<-----------| __________________________________________ for n stacks make n/2 such intervals. If n is odd, one interval will be for a single stack. -- 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.
