stack

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Val  any
	Next *Node
}

Node structure

type SList

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

SList is our struct that point to stack with container/list.List library

func (*SList) Empty

func (sl *SList) Empty() bool

Empty check our stack has value or not

func (*SList) Length

func (sl *SList) Length() int

Length return length of our stack

func (*SList) Peak

func (sl *SList) Peak() (any, error)

Peak is return last value that insert into our stack

func (*SList) Pop

func (sl *SList) Pop() (any, error)

Pop is return last value that insert into our stack also it will remove it in our stack

func (*SList) Push

func (sl *SList) Push(val any)

Push add a value into our stack

type Stack

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

Stack has jost top of node and with length

Jump to

Keyboard shortcuts

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