fix(curriculam): include initStack in stack implementation requirements (#66846)

Co-authored-by: Venkat <venkat@Venkats-MacBook-Pro.local>
This commit is contained in:
Venkataramana Devathoti
2026-04-09 11:50:10 +05:30
committed by GitHub
parent 83bf9eb062
commit 04d44aa177
@@ -13,13 +13,14 @@ In this lab, you will implement a stack data structure using functions. A stack
**User Stories:**
1. You should have an `initStack` function that returns an object with a `collection` property set to an empty array.
1. You should have a `push` function that adds an element to the top of the stack.
1. You should have a `pop` function that removes and returns the top element of the stack, or `undefined` if there isn't one.
1. You should have a `peek` function that returns the top element of the stack without removing it, or `undefined` if there isn't one.
1. You should have a `isEmpty` function that returns `true` if the stack contains no elements, and `false` otherwise.
1. You should have an `isEmpty` function that returns `true` if the stack contains no elements, and `false` otherwise.
1. You should have a `clear` function that removes all elements from the stack.
**Note:** Most tests depend on the `push` function. Implement `push` first, as tests for `pop`, `peek`, `isEmpty`, and `clear` require adding elements to the stack.
**Note:** Most tests depend on the `initStack` and `push` functions. Implement them first, as tests for `pop`, `peek`, `isEmpty`, and `clear` require adding elements to the stack.
# --hints--