开发者

Implementing 3 stacks in one Array using C++

开发者 https://www.devze.com 2023-03-29 16:10 出处:网络
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?

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号