1 Star 0 Fork 0

Jerris/algorithm-go

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
array-stack_test.go 519 Bytes
一键复制 编辑 原始数据 按行查看 历史
b30053545 提交于 2024-02-06 15:18 +08:00 . 删除Object接口
package stack
import (
"fmt"
"testing"
)
func TestArrayStack(t *testing.T) {
stack := NewArrayStack[int]()
fmt.Printf("stack is empty: %v\n", stack.IsEmpty())
fmt.Println(stack)
stack.Push(5)
stack.Push(4)
stack.Push(3)
stack.Push(2)
stack.Push(1)
fmt.Println(stack)
fmt.Printf("stack is empty: %v\n", stack.IsEmpty())
fmt.Printf("stack's peek is: %v\n", stack.Peek())
fmt.Printf("stack's size is: %v\n", stack.Size())
fmt.Println("stack pops:")
for !stack.IsEmpty() {
fmt.Println(stack.Pop())
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jerris-code-space/algorithm-go.git
git@gitee.com:jerris-code-space/algorithm-go.git
jerris-code-space
algorithm-go
algorithm-go
master

搜索帮助