Reputation: 213
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
Upvotes: 0
Views: 643
Reputation: 272802
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?
Upvotes: 1