From bed8b07b0b3c9c27198ff9e89c297883a7f4d4ff Mon Sep 17 00:00:00 2001 From: reanon <793584285@qq.com> Date: Tue, 29 Nov 2022 01:10:51 +0800 Subject: [PATCH] feat(deeue): implement deque in golang code --- codes/go/chapter_stack_and_queue/deque.go | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 codes/go/chapter_stack_and_queue/deque.go diff --git a/codes/go/chapter_stack_and_queue/deque.go b/codes/go/chapter_stack_and_queue/deque.go new file mode 100644 index 0000000..fb419a6 --- /dev/null +++ b/codes/go/chapter_stack_and_queue/deque.go @@ -0,0 +1,27 @@ +// File: deque.go +// Created Time: 2022-11-29 +// Author: Reanon (793584285@qq.com) + +package chapter_stack_and_queue + +type Deque interface { + // OfferFirst 元素入队 + OfferFirst(num int) + // OfferLast 元素入队 + OfferLast(num int) + + // PeekFirst 访问首元素 + PeekFirst() int + // PeekLast 访问尾元素 + PeekLast() int + + // PollFirst 元素出队 + PollFirst() int + // PollLast 元素出队 + PollLast() int + + // Size 获取队列长度 + Size() int + // IsEmpty 队列是否为空 + IsEmpty() bool +}