stack

package
v0.0.0-...-de2953b Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reverse

func Reverse(s *stack.S)

递归原地逆序栈.

Types

type MyStack

type MyStack struct {
	SData *stack.S
	SMin  *stack.S // 维护最小值
}

用栈获取最小值.

func NewMyStack

func NewMyStack() *MyStack

func (*MyStack) GetMin

func (s *MyStack) GetMin() int

func (*MyStack) Pop

func (s *MyStack) Pop() int

func (*MyStack) Push

func (s *MyStack) Push(d int)

type TwoStackQueue

type TwoStackQueue struct {
	SPush *stack.S
	SPop  *stack.S
}

双栈实现队列.

func NewTwoStackQueue

func NewTwoStackQueue() *TwoStackQueue

func (*TwoStackQueue) Add

func (t *TwoStackQueue) Add(i int)

func (*TwoStackQueue) Peek

func (t *TwoStackQueue) Peek() int

func (*TwoStackQueue) Poll

func (t *TwoStackQueue) Poll() int

Jump to

Keyboard shortcuts

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