tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

[ISSUE] Wrong explanation for "ArrayDeque for stack"

Open ravening opened this issue 1 year ago • 0 comments

Article and Module Links Java ArrayDeque

Describe the Issue When ArrayDeque is used to implement a stack, it acts as LIFO(Last In First Out). So the element which is added at the last should be removed first. So in the above mentioned link, we are inserting two elements into stack. "first" and "second" . When we call the pop function, the element "second" should be removed first but the explanation says "first" will be removed which is wrong.

To Reproduce Steps to reproduce the behavior:

  1. Go to this link
  2. Read the description and the text in the image
  3. The description is wrong

Expected Behavior When pop method is called on stack, it should return "second" as the value and set the index 1 to null

ravening avatar Aug 15 '24 21:08 ravening