-
Notifications
You must be signed in to change notification settings - Fork 20.7k
Open
Labels
awaiting triageAwaiting triage from a maintainerAwaiting triage from a maintainer
Description
What would you like to share?
📝 Description
The current /stacks directory in the repository includes various stack algorithms and implementations (e.g., using two queues, min stacks, postfix/prefix evaluation, etc.), but it lacks an implementation of a Stack data structure using a Linked List.
I would like to contribute a clean, well-documented implementation of StackUsingLinkedList.java under the /stacks package.
💡 Proposed Solution
Implement a StackUsingLinkedList class that supports the following standard stack operations:
push(T data)– insert an element onto the stackpop()– remove and return the top elementpeek()– view the top element without removing itisEmpty()– check if the stack is emptysize()– return the number of elements in the stack
Implementation Details
- Use a singly linked list (with a
Nodeinner class) to store elements. - Ensure O(1) time complexity for push and pop operations.
- Follow the repository’s naming conventions and JavaDocs style comments.
- Include a small
mainmethod or test snippet demonstrating the functionality.
Additional information
No response
Metadata
Metadata
Assignees
Labels
awaiting triageAwaiting triage from a maintainerAwaiting triage from a maintainer