polynomial

package
v0.0.0-...-24ca9bf Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package polynomial provides functions that support polynomial arithmetic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringDigits

func StringDigits(n int) string

StringDigits parses an integer value one digit at a time, starting with least significant, and returns a string representation.

Types

type List

type List struct {
	SignBit bool      `default:"false"`
	First   *ListNode `default:"&ListNode{}"`
	Last    *ListNode `default:"nil"`
}

List defines the boundaries of a list signly linked list.

func ListDigits

func ListDigits(n int) *List

func New

func New(n int) *List

New returns a new List with each digit of the value n set to its own ListNode.

func (*List) Free

func (l *List) Free()

func (*List) LoadInt

func (l *List) LoadInt(n int) string

LoadInt loads the digits of n into a List and returns the String() response. The digits will be in reverse order.

func (*List) String

func (l *List) String() string

type ListNode

type ListNode struct {
	Val  int       `default:"0"`
	Next *ListNode `default:"nil"`
}

ListNode defines a singly-linked list of integer values.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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