954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help with array stack vs pointer stack

I have just started to learn about stacks and have been scouring the net for information. I am having trouble coming up with an answer for this question:

Suppose you were asked to add a function CountStack to the stack ADT that would return the number of items in the stack. Explain how this function would work for an array-based stack and what would change for a pointer-based stack.

Can anyone help me understand the differences?
Any help is much appreciated.

skeet123
Newbie Poster
20 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

Assuming some things, the difference is traversing a linked list to a null pointer and returning the index of the top of the stack.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

checking time

proxy_x
Newbie Poster
3 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You