Implementing 3 stacks in one Array using C++
Was wondering how this can be done using C开发者_运维技巧++.
Divide given array into 3 parts - (0 - N/3), (N/3 - 2N/3) , (2N/3 - N). How would i keep track of the overflow?
Thanks Kelly
You must necessarily maintain a pointer-to-top for each of your stacks. Why not just check that these pointers don't exceed their bounds?
精彩评论