implementqueueusingstacksgo

package
v0.0.0-...-8653abf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MyQueue

type MyQueue struct {
	// contains filtered or unexported fields
}

func Constructor

func Constructor() MyQueue

func (*MyQueue) Empty

func (this *MyQueue) Empty() bool

func (*MyQueue) Peek

func (this *MyQueue) Peek() int

func (*MyQueue) Pop

func (this *MyQueue) Pop() int

func (*MyQueue) Push

func (this *MyQueue) Push(x int)

type MyQueue2

type MyQueue2 struct {
	Queue []int
}

==================================================== 非 Stack 的解法

func Constructor2

func Constructor2() MyQueue2

func (*MyQueue2) Empty

func (this *MyQueue2) Empty() bool

func (*MyQueue2) Peek

func (this *MyQueue2) Peek() int

func (*MyQueue2) Pop

func (this *MyQueue2) Pop() int

func (*MyQueue2) Push

func (this *MyQueue2) Push(x int)

type Stack

type Stack []int

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

func (*Stack) Len

func (s *Stack) Len() int

func (*Stack) Peek

func (s *Stack) Peek() (int, bool)

func (*Stack) Pop

func (s *Stack) Pop() (int, bool)

func (*Stack) Push

func (s *Stack) Push(num int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL