day50

package
v0.0.0-...-36687a4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calculate

func Calculate(tree *ArithmeticTree) int

Calculate takes an ArithmeticTree and returns its calculated value. Runs in O(N) in that it only views the tree nodes once.

Types

type ArithmeticTree

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

ArithmeticTree represents either a node operator or a leaf value.

type Operator

type Operator int

Operator represents the arithmetic operations.

const (
	// NON is a zero value of this constant.
	NON Operator = iota
	// ADD is addition
	ADD
	// SUB is subtraction
	SUB
	// MUL is multiplication
	MUL
	// DIV is division
	DIV
)

Jump to

Keyboard shortcuts

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