push add value to last index
(n any)
| 23 | |
| 24 | // push add value to last index |
| 25 | func (ll *Stack) Push(n any) { |
| 26 | newStack := &Node{} // new node |
| 27 | |
| 28 | newStack.Val = n |
| 29 | newStack.Next = ll.top |
| 30 | |
| 31 | ll.top = newStack |
| 32 | ll.length++ |
| 33 | } |
| 34 | |
| 35 | // pop remove last item as first output |
| 36 | func (ll *Stack) Pop() any { |
no outgoing calls