开发者

Determining the location of Top Of Stack

I am t开发者_高级运维rying to create an array based implementation of Stacks. I am a bit confused with where should the Top Of Stack (a variable in my implementation) be when,

  • The list is empty
  • The list is full
  • The list is neither empty and not full Please help me out.

Thanks.


That depends only how you define TopOfStack: is it the first unused slot? Or is it the last thing pushed onto the stack.

As soon as you choose one of those two options the rest can be deduced easily.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜