dsa

package
v0.0.0-...-d8a24b1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinarySearch

func BinarySearch[K cmp.Ordered](a []K, x K) (int, bool)

func BinarySearchCustom

func BinarySearchCustom[K Comparable](a []K, x K) (int, bool)

Types

type Comparable

type Comparable interface {
	Equals(x Comparable) bool
	Less(x Comparable) bool
}

type Stack

type Stack[T any] []T

func (*Stack[T]) Peek

func (s *Stack[T]) Peek() T

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

func (*Stack[T]) Push

func (s *Stack[T]) Push(x T)

type TreeNode

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

func ArrayToBinaryTree

func ArrayToBinaryTree(arr []int) *TreeNode

Jump to

Keyboard shortcuts

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