mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-27 04:12:40 +08:00
fix(go): modify interface of stack, queue and deque
This commit is contained in:
@ -6,13 +6,15 @@ package chapter_stack_and_queue
|
||||
|
||||
type Queue interface {
|
||||
// Offer 元素入队
|
||||
Offer(num int)
|
||||
Offer(num any)
|
||||
// Peek 访问首元素
|
||||
Peek() int
|
||||
Peek() any
|
||||
// Poll 元素出队
|
||||
Poll() int
|
||||
Poll() any
|
||||
// Size 获取队列长度
|
||||
Size() int
|
||||
// IsEmpty 队列是否为空
|
||||
IsEmpty() bool
|
||||
// toString 队列输出为字符串
|
||||
toString() string
|
||||
}
|
||||
|
Reference in New Issue
Block a user