If your method implementation does not animate or animates incorrectly,
check these items:
■
Check the feedback in the window to see if your code gives the cor-
rect result.
■
Verify that you updated the value of top correctly.
■
Verify that you correctly coded the cases where the stack is full
(push method) and the stack is empty (pop method).
DISCUSSION QUESTIONS
1.Explain how the array elements above the index top can have assigned values,but
are still irrelevant.
2.Explain what happens if you do not test whether the stack is empty in the pop
method or full in the push method.
?
14.7Array ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.