Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/GoTurkiye/training
/ NewStack
Function
NewStack
301-algorithms/linear-lists/stack/stack.go:11–17 ·
view source on GitHub ↗
(capacity uint64)
Source
from the content-addressed store, hash-verified
9
}
10
11
func
NewStack(capacity uint64) *Stack {
12
return
&Stack{
13
capacity: capacity,
14
list: make([]MyItem, capacity),
15
depth: 0,
16
}
17
}
18
19
func
(s *Stack) Push(value MyItem) {
20
if
s.depth >= s.capacity {
Callers
1
main
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected