gods

package
v0.0.0-...-93f1c43 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Null = -1 << 63

Functions

func List2Ints

func List2Ints(head *ListNode) []int

Types

type Heap

type Heap struct {
	Array []int
}

func (*Heap) Extract

func (h *Heap) Extract() int

Extract returns the largest key, and removes it from the heap.

func (*Heap) HeapifyDown

func (h *Heap) HeapifyDown(index int)

HeapifyDown will be heapify top to bottom

func (*Heap) HeapifyUp

func (h *Heap) HeapifyUp(index int)

HeapifyUp will heapify from bottom top

func (*Heap) Insert

func (h *Heap) Insert(key int)

Insert adds an element to the heap

type LinkedList

type LinkedList struct {
	Head   *ListNode
	Length int
}

func (*LinkedList) Append

func (l *LinkedList) Append(n *ListNode)

func (*LinkedList) Delete

func (l *LinkedList) Delete(position int) bool

func (*LinkedList) DeleteWithValue

func (l *LinkedList) DeleteWithValue(value int)

func (*LinkedList) Insert

func (l *LinkedList) Insert(n *ListNode, position int) bool

func (*LinkedList) Prepend

func (l *LinkedList) Prepend(n *ListNode)

func (LinkedList) PrintListVal

func (l LinkedList) PrintListVal()

type ListNode

type ListNode struct {
	Val  int
	Next *ListNode
}

func Ints2List

func Ints2List(nums []int) *ListNode

type NaryNode

type NaryNode struct {
	Val      int
	Children []*NaryNode
}

func Ints2NaryNode

func Ints2NaryNode(nodes []int) *NaryNode

type Stack

type Stack struct {
	Items []interface{}
}

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

func (*Stack) Peek

func (s *Stack) Peek() interface{}

func (*Stack) Pop

func (s *Stack) Pop() interface{}

func (*Stack) Push

func (s *Stack) Push(item interface{})

func (*Stack) Size

func (s *Stack) Size() int

type TreeNode

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

func Ints2TreeNode

func Ints2TreeNode(ints []int) *TreeNode

Source: halfrost

func (*TreeNode) Delete

func (t *TreeNode) Delete(val int)

func (*TreeNode) Insert

func (t *TreeNode) Insert(val int)

func (*TreeNode) Search

func (t *TreeNode) Search(val int) bool

Jump to

Keyboard shortcuts

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