Package avl is a Adelson-Velskii and Landis tree implemnation avl is self-balancing tree, i.e for all node in a tree, height difference between its left and right child will not exceed 1 more information : https://en.wikipedia.org/wiki/AVL_tree

Package binary describes algorithms that use binary operations for different calculations.

Functions:

BitCounter: BitCounter - The function returns the number of set bits for an unsigned integer number

IsPowerOfTwo: IsPowerOfTwo This function uses the fact that powers of 2 are represented like 10...0 in binary, and numbers one less than the power of 2 are represented like 11...1. Therefore, using the and function: 10...0 & 01...1 00...0 -> 0 This is also true for 0, which is not a power of 2, for which we have to add and extra condition.

IsPowerOfTwoLeftShift: IsPowerOfTwoLeftShift This function takes advantage of the fact that left shifting a number by 1 is equivalent to multiplying by 2. For example, binary 00000001 when shifted by 3 becomes 00001000, which in decimal system is 8 or = 2 * 2 * 2

MeanUsingAndXor: MeanUsingAndXor This function finds arithmetic mean using "AND" and "XOR" operations

MeanUsingRightShift: MeanUsingRightShift This function finds arithmetic mean using right shift

ReverseBits: ReverseBits This function initialized the result by 0 (all bits 0) and process the given number starting from its least significant bit. If the current bit is 1, set the corresponding most significant bit in the result and finally move on to the next bit in the input number. Repeat this till all its bits are processed.

XorSearchMissingNumber: XorSearchMissingNumber This function finds a missing number in a sequence

binarytree

Functions:

AccessNodesByLayer: AccessNodesByLayer Function that access nodes layer by layer instead of printing the results as one line.

Decrypt: Decrypt decrypts by left shift of "key" each character of "input"

Encrypt: Encrypt encrypts by right shift of "key" each character of "input"

catalan

Functions:

CatalanNumber: CatalanNumber This function returns the nth Catalan number

coloring

Package coloring provides implementation of different graph coloring algorithms, e.g. coloring using BFS, using Backtracking, using greedy approach. Author(s): Shivam

Functions:

BipartiteCheck: basically tries to color the graph in two colors if each edge connects 2 differently colored nodes the graph can be considered bipartite

BinaryToDecimal: BinaryToDecimal() function that will take Binary number as string, and return it's Decimal equivalent as integer.

DecimalToBinary: DecimalToBinary() function that will take Decimal number as int, and return it's Binary equivalent as string.

HEXToRGB: HEXToRGB splits an RGB input (e.g. a color in hex format; 0x) into the individual components: red, green and blue

IntToRoman: IntToRoman converts an integer value to a roman numeral string. An error is returned if the integer is not between 1 and 3999.

RGBToHEX: RGBToHEX does exactly the opposite of HEXToRGB: it combines the three components red, green and blue to an RGB value, which can be converted to e.g. Hex

Reverse: Reverse() function that will take string, and returns the reverse of that string.

RomanToInteger: RomanToInteger converts a roman numeral string to an integer. Roman numerals for numbers outside the range 1 to 3,999 will return an error. Nil or empty string return 0 with no error thrown.

GenerateMutualKey: GenerateMutualKey : generates a mutual key that can be used by only alice and bob mutualKey = (shareKey^prvKey)%primeNumber

GenerateShareKey: GenerateShareKey : generates a key using client private key , generator and primeNumber this key can be made public shareKey = (g^key)%primeNumber

dynamic

Package dynamic is a package of certain implementations of dynamically run algorithms.

CutRodDp: CutRodDp solve the same problem using dynamic programming

CutRodRec: CutRodRec solve the problem recursively: initial approach

EditDistanceDP: EditDistanceDP is an optimised implementation which builds on the ideas of the recursive implementation. We use dynamic programming to compute the DP table where dp[i][j] denotes the edit distance value of first[0..i-1] and second[0..j-1]. Time complexity is O(m * n) where m and n are lengths of the strings, first and second respectively.

EditDistanceRecursive: EditDistanceRecursive is a naive implementation with exponential time complexity.

LongestIncreasingSubsequence: LongestIncreasingSubsequence returns the longest increasing subsequence where all elements of the subsequence are sorted in increasing order

NthCatalanNumber: NthCatalan returns the n-th Catalan Number Complexity: O(n²)

NthFibonacci: NthFibonacci returns the nth Fibonacci Number

dynamicarray

Package dynamicarray A dynamic array is quite similar to a regular array, but its Size is modifiable during program runtime, very similar to how a slice in Go works. The implementation is for educational purposes and explains how one might go about implementing their own version of slices. For more details check out those links below here: GeeksForGeeks article : https://www.geeksforgeeks.org/how-do-dynamic-arrays-work/ Go blog: https://blog.golang.org/slices-intro Go blog: https://blog.golang.org/slices authors Wesllhey Holanda, Milad see dynamicarray.go, dynamicarray_test.go

GeneticString: GeneticString generates PopultaionItem based on the imputed target string, and a set of possible runes to build a string with. In order to optimise string generation additional configurations can be provided with Conf instance. Empty instance of Conf (&Conf{}) can be provided, then default values would be set. Link to the same algorithm implemented in python: https://github.com/TheAlgorithms/Python/blob/master/genetic_algorithm/basic_string.py

Distance: Calculates the shortest distance between two points.

Intercept: Calculates the Y-Intercept of a line from a specific Point.

IsParallel: Checks if two lines are parallel or not.

IsPerpendicular: Checks if two lines are perpendicular or not.

PointDistance: Calculates the distance of a given Point from a given line. The slice should contain the coefficiet of x, the coefficient of y and the constant in the respective order.

Section: Calculates the Point that divides a line in specific ratio. DO NOT specify the ratio in the form m:n, specify it as r, where r = m / n.

BreadthFirstSearch: BreadthFirstSearch is an algorithm for traversing and searching graph data structures. It starts at an arbitrary node of a graph, and explores all of the neighbor nodes at the present depth prior to moving on to the nodes at the next depth level. Worst-case performance O(|V|+|E|)=O(b^{d})}O(|V|+|E|)=O(b^{d}) Worst-case space complexity O(|V|)=O(b^{d})}O(|V|)=O(b^{d}) reference: https://en.wikipedia.org/wiki/Breadth-first_search

KruskalMST: KruskalMST will return a minimum spanning tree along with its total cost to using Kruskal's algorithm. Time complexity is O(m * log (n)) where m is the number of edges in the graph and n is number of nodes in it.

New: Constructor functions for graphs (undirected by default)

NewDSU: NewDSU will return an initialised DSU using the value of n which will be treated as the number of elements out of which the DSU is being made

Topological: Assumes that graph given is valid and possible to get a topo ordering. constraints are array of []int{a, b}, representing an edge going from a to b

Kmp: Kmp Function kmp performing the Knuth-Morris-Pratt algorithm. Prints whether the word/pattern was found and on what position in the text or not. m - current match in text, i - current character in w, c - amount of comparisons.

Package math is a package that contains mathematical algorithms and its different implementations.

Functions:

IsPowOfTwoUseLog: IsPowOfTwoUseLog This function checks if a number is a power of two using the logarithm. The limiting degree can be from 0 to 63. See alternatives in the binary package.

Phi: Phi is the Euler totient function. This function computes the number of numbers less then n that are coprime with n.

max

Functions:

Bitwise: Bitwise computes using bitwise operator the maximum of all the integer input and returns it

Int: Int is a function which returns the maximum of all the integers provided as arguments.

maxsubarraysum

Package maxsubarraysum is a package containing a solution to a common problem of finding max contiguous sum within a array of ints.

Functions:

MaxSubarraySum: MaxSubarraySum returns the maximum subarray sum

min

Functions:

Bitwise: Bitwise This function returns the minimum integer using bit operations

Int: Int is a function which returns the minimum of all the integers provided as arguments.

modular

Functions:

Exponentiation: Exponentiation returns base^exponent % mod

Package nested provides functions for testing strings proper brackets nesting.

Functions:

IsBalanced: IsBalanced returns true if provided input string is properly nested. Input is a sequence of brackets: '(', ')', '[', ']', '{', '}'. A sequence of brackets s is considered properly nested if any of the following conditions are true: - s is empty; - s has the form (U) or [U] or {U} where U is a properly nested string; - s has the form VW where V and W are properly nested strings. For example, the string "()()[()]" is properly nested but "[(()]" is not. Note Providing characters other then brackets would return false, despite brackets sequence in the string. Make sure to filter input before usage.

Factorize: Factorize is a function that computes the exponents of each prime in the prime factorization of n

Generate: Generate returns a int slice of prime numbers up to the limit

GenerateChannel: Generate generates the sequence of integers starting at 2 and sends it to the channel ch

MillerRabinTest: MillerRabinTest Probabilistic test for primality of an integer based of the algorithm devised by Miller and Rabin.

MillerTest: MillerTest This is the intermediate step that repeats within the miller rabin primality test for better probabilitic chances of receiving the correct result.

NaiveApproach: NaiveApproach checks if an integer is prime or not. Returns a bool.

PairApproach: PairApproach checks primality of an integer and returns a bool. More efficient than the naive approach as number of iterations are less.

Sieve: Sieve Sieving the numbers that are not prime from the channel - basically removing them from the channels

pythagoras

Functions:

Distance: Distance calculates the distance between to vectors with the Pythagoras theorem

package set implements a Set using a golang map. This implies that only the types that are accepted as valid map keys can be used as set elements. For instance, do not try to Add a slice, or the program will panic.

Hash: Hash hashes the input message using the sha256 hashing function, and return a 32 byte array. The implementation follows the RGC6234 standard, which is documented at https://datatracker.ietf.org/doc/html/rfc6234

sort

Package sort a package for demonstrating sorting algorithms in Go

ImprovedSimpleSort: ImprovedSimpleSort is a improve SimpleSort by skipping an unnecessary comparison of the first and last. This improved version is more similar to implementation of insertion sort

Encrypt: Encrypt encrypts with Xor encryption after converting each character to byte The returned value might not be readable because there is no guarantee which is within the ASCII range If using other type such as string, []int, or some other types, add the statements for converting the type to []byte.

## TheAlgorithms/Go

## The Algorithms - Go

## Algorithms implemented in Go (for education)

The repository is a collection of open-source implementation of a variety of algorithms implemented in Go and licensed under MIT License.

Read our Contribution Guidelines before you contribute.

## List of Algorithms

## Packages:

ahocorasick## Functions:

`Advanced`

: Advanced Function performing the Advanced Aho-Corasick algorithm. Finds and prints occurrences of each pattern.`AhoCorasick`

: AhoCorasick Function performing the Basic Aho-Corasick algorithm. Finds and prints occurrences of each pattern.`ArrayUnion`

: ArrayUnion Concats two arrays of int's into one.`BoolArrayCapUp`

: BoolArrayCapUp Dynamically increases an array size of bool's by 1.`BuildAc`

: Functions that builds Aho Corasick automaton.`BuildExtendedAc`

: BuildExtendedAc Functions that builds extended Aho Corasick automaton.`ComputeAlphabet`

: ComputeAlphabet Function that returns string of all the possible characters in given patterns.`ConstructTrie`

: ConstructTrie Function that constructs Trie as an automaton for a set of reversed & trimmed strings.`Contains`

: Contains Returns 'true' if array of int's 's' contains int 'e', 'false' otherwise.`CreateNewState`

: CreateNewState Automaton function for creating a new state 'state'.`CreateTransition`

: CreateTransition Creates a transition for function σ(state,letter) = end.`GetParent`

: GetParent Function that finds the first previous state of a state and returns it. Used for trie where there is only one parent.`GetTransition`

: GetTransition Returns ending state for transition σ(fromState,overChar), '-1' if there is none.`GetWord`

: GetWord Function that returns word found in text 't' at position range 'begin' to 'end'.`IntArrayCapUp`

: IntArrayCapUp Dynamically increases an array size of int's by 1.`StateExists`

: StateExists Checks if state 'state' exists. Returns 'true' if it does, 'false' otherwise.## Types

`Result`

: No description provided.armstrong## Functions:

`IsArmstrong`

: No description provided.avl## Package avl is a Adelson-Velskii and Landis tree implemnation avl is self-balancing tree, i.e for all node in a tree, height difference between its left and right child will not exceed 1 more information : https://en.wikipedia.org/wiki/AVL_tree

## Functions:

`Delete`

: Delete : remove given key from the tree`Get`

: Get : return node with given key`Insert`

: Insert a new item`NewTree`

: NewTree create a new AVL tree## Types

`Node`

: No description provided.binary## Package binary describes algorithms that use binary operations for different calculations.

## Functions:

`BitCounter`

: BitCounter - The function returns the number of set bits for an unsigned integer number`IsPowerOfTwo`

: IsPowerOfTwo This function uses the fact that powers of 2 are represented like 10...0 in binary, and numbers one less than the power of 2 are represented like 11...1. Therefore, using the and function: 10...0 & 01...1 00...0 -> 0 This is also true for 0, which is not a power of 2, for which we have to add and extra condition.`IsPowerOfTwoLeftShift`

: IsPowerOfTwoLeftShift This function takes advantage of the fact that left shifting a number by 1 is equivalent to multiplying by 2. For example, binary 00000001 when shifted by 3 becomes 00001000, which in decimal system is 8 or = 2 * 2 * 2`MeanUsingAndXor`

: MeanUsingAndXor This function finds arithmetic mean using "AND" and "XOR" operations`MeanUsingRightShift`

: MeanUsingRightShift This function finds arithmetic mean using right shift`ReverseBits`

: ReverseBits This function initialized the result by 0 (all bits 0) and process the given number starting from its least significant bit. If the current bit is 1, set the corresponding most significant bit in the result and finally move on to the next bit in the input number. Repeat this till all its bits are processed.`XorSearchMissingNumber`

: XorSearchMissingNumber This function finds a missing number in a sequencebinarytree## Functions:

`AccessNodesByLayer`

: AccessNodesByLayer Function that access nodes layer by layer instead of printing the results as one line.`BstDelete`

: BstDelete removes the node`InOrder`

: Travers the tree in the following order left --> root --> right`InOrderSuccessor`

: InOrderSuccessor Goes to the left`Insert`

: Insert a value in the BSTree`LevelOrder`

: No description provided.`Max`

: Max Function that returns max of two numbers - possibly already declared.`NewNode`

: NewNode Returns a new pointer to an empty Node`PostOrder`

: Travers the tree in the following order left --> right --> root`PreOrder`

: Travers the tree in the following order root --> left --> right## Types

`BSTree`

: No description provided.`Node`

: No description provided.caesar## Package caesar is the shift cipher ref: https://en.wikipedia.org/wiki/Caesar_cipher

## Functions:

`Decrypt`

: Decrypt decrypts by left shift of "key" each character of "input"`Encrypt`

: Encrypt encrypts by right shift of "key" each character of "input"catalan## Functions:

`CatalanNumber`

: CatalanNumber This function returns the`nth`

Catalan numbercoloring## Package coloring provides implementation of different graph coloring algorithms, e.g. coloring using BFS, using Backtracking, using greedy approach. Author(s): Shivam

## Functions:

`BipartiteCheck`

: basically tries to color the graph in two colors if each edge connects 2 differently colored nodes the graph can be considered bipartite## Types

`Graph`

: No description provided.combination## Package combination ...

## Functions:

`Start`

: Start ...## Types

`Combinations`

: No description provided.conversion## Package conversion is a package of implementations which converts one data structure to another.

## Functions:

`Base64Decode`

: Base64Decode decodes the received input base64 string into a byte slice. The implementation follows the RFC4648 standard, which is documented at https://datatracker.ietf.org/doc/html/rfc4648#section-4`Base64Encode`

: Base64Encode encodes the received input bytes slice into a base64 string. The implementation follows the RFC4648 standard, which is documented at https://datatracker.ietf.org/doc/html/rfc4648#section-4`BinaryToDecimal`

: BinaryToDecimal() function that will take Binary number as string, and return it's Decimal equivalent as integer.`DecimalToBinary`

: DecimalToBinary() function that will take Decimal number as int, and return it's Binary equivalent as string.`HEXToRGB`

: HEXToRGB splits an RGB input (e.g. a color in hex format; 0x) into the individual components: red, green and blue`IntToRoman`

: IntToRoman converts an integer value to a roman numeral string. An error is returned if the integer is not between 1 and 3999.`RGBToHEX`

: RGBToHEX does exactly the opposite of HEXToRGB: it combines the three components red, green and blue to an RGB value, which can be converted to e.g. Hex`Reverse`

: Reverse() function that will take string, and returns the reverse of that string.`RomanToInteger`

: RomanToInteger converts a roman numeral string to an integer. Roman numerals for numbers outside the range 1 to 3,999 will return an error. Nil or empty string return 0 with no error thrown.diffiehellman## Package diffiehellman implements Deffie Hellman Key Exchange Algorithm for more information watch : https://www.youtube.com/watch?v=NmM9HA2MQGI

## Functions:

`GenerateMutualKey`

: GenerateMutualKey : generates a mutual key that can be used by only alice and bob mutualKey = (shareKey^prvKey)%primeNumber`GenerateShareKey`

: GenerateShareKey : generates a key using client private key , generator and primeNumber this key can be made public shareKey = (g^key)%primeNumberdynamic## Package dynamic is a package of certain implementations of dynamically run algorithms.

## Functions:

`Bin2`

: Bin2 function`CutRodDp`

: CutRodDp solve the same problem using dynamic programming`CutRodRec`

: CutRodRec solve the problem recursively: initial approach`EditDistanceDP`

: EditDistanceDP is an optimised implementation which builds on the ideas of the recursive implementation. We use dynamic programming to compute the DP table where dp[i][j] denotes the edit distance value of first[0..i-1] and second[0..j-1]. Time complexity is O(m * n) where m and n are lengths of the strings, first and second respectively.`EditDistanceRecursive`

: EditDistanceRecursive is a naive implementation with exponential time complexity.`IsSubsetSum`

: No description provided.`Knapsack`

: Knapsack solves knapsack problem return maxProfit`LongestCommonSubsequence`

: LongestCommonSubsequence function`LongestIncreasingSubsequence`

: LongestIncreasingSubsequence returns the longest increasing subsequence where all elements of the subsequence are sorted in increasing order`LpsDp`

: LpsDp function`LpsRec`

: LpsRec function`MatrixChainDp`

: MatrixChainDp function`MatrixChainRec`

: MatrixChainRec function`Max`

: Max function - possible duplicate`NthCatalanNumber`

: NthCatalan returns the n-th Catalan Number Complexity: O(n²)`NthFibonacci`

: NthFibonacci returns the nth Fibonacci Numberdynamicarray## Package dynamicarray A dynamic array is quite similar to a regular array, but its Size is modifiable during program runtime, very similar to how a slice in Go works. The implementation is for educational purposes and explains how one might go about implementing their own version of slices. For more details check out those links below here: GeeksForGeeks article : https://www.geeksforgeeks.org/how-do-dynamic-arrays-work/ Go blog: https://blog.golang.org/slices-intro Go blog: https://blog.golang.org/slices authors Wesllhey Holanda, Milad see dynamicarray.go, dynamicarray_test.go

## Types

`DynamicArray`

: No description provided.factorial## Package factorial describes algorithms Factorials calculations.

## Functions:

`Iterative`

: Iterative returns the iteratively brute forced factorial of n`Recursive`

: Recursive This function recursively computes the factorial of a number`UsingTree`

: UsingTree This function finds the factorial of a number using a binary treefibonacci## Functions:

`Matrix`

: Matrix This function calculates the n-th fibonacci number using the matrix method. Seegcd## Functions:

`Extended`

: Extended simple extended gcd`ExtendedIterative`

: ExtendedIterative finds and returns gcd(a, b), x, y satisfying ax + by = gcd(a, b).`ExtendedRecursive`

: ExtendedRecursive finds and returns gcd(a, b), x, y satisfying ax + by = gcd(a, b).`Iterative`

: Iterative Faster iterative version of GcdRecursive without holding up too much of the stack`Recursive`

: Recursive finds and returns the greatest common divisor of a given integer.`TemplateBenchmarkExtendedGCD`

: No description provided.`TemplateBenchmarkGCD`

: No description provided.`TemplateTestExtendedGCD`

: No description provided.`TemplateTestGCD`

: No description provided.generateparentheses## Functions:

`GenerateParenthesis`

: No description provided.genetic## Package genetic provides functions to work with strings using genetic algorithm. https://en.wikipedia.org/wiki/Genetic_algorithm Author: D4rkia

## Functions:

`GeneticString`

: GeneticString generates PopultaionItem based on the imputed target string, and a set of possible runes to build a string with. In order to optimise string generation additional configurations can be provided with Conf instance. Empty instance of Conf (&Conf{}) can be provided, then default values would be set. Link to the same algorithm implemented in python: https://github.com/TheAlgorithms/Python/blob/master/genetic_algorithm/basic_string.py## Types

`Conf`

: No description provided.`PopulationItem`

: No description provided.`Result`

: No description provided.geometry## Functions:

`Distance`

: Calculates the shortest distance between two points.`Intercept`

: Calculates the Y-Intercept of a line from a specific Point.`IsParallel`

: Checks if two lines are parallel or not.`IsPerpendicular`

: Checks if two lines are perpendicular or not.`PointDistance`

: Calculates the distance of a given Point from a given line. The slice should contain the coefficiet of x, the coefficient of y and the constant in the respective order.`Section`

: Calculates the Point that divides a line in specific ratio. DO NOT specify the ratio in the form m:n, specify it as r, where r = m / n.`Slope`

: Calculates the slope (gradient) of a line.## Types

`Line`

: No description provided.`Point`

: No description provided.graph## Package graph demonstrates Graph search algorithms reference: https://en.wikipedia.org/wiki/Tree_traversal

## Functions:

`BreadthFirstSearch`

: BreadthFirstSearch is an algorithm for traversing and searching graph data structures. It starts at an arbitrary node of a graph, and explores all of the neighbor nodes at the present depth prior to moving on to the nodes at the next depth level. Worst-case performance O(|V|+|E|)=O(b^{d})}O(|V|+|E|)=O(b^{d}) Worst-case space complexity O(|V|)=O(b^{d})}O(|V|)=O(b^{d}) reference: https://en.wikipedia.org/wiki/Breadth-first_search`DepthFirstSearch`

: No description provided.`DepthFirstSearchHelper`

: No description provided.`FloydWarshall`

: FloydWarshall Returns all pair's shortest path using Floyd Warshall algorithm`GetIdx`

: No description provided.`KruskalMST`

: KruskalMST will return a minimum spanning tree along with its total cost to using Kruskal's algorithm. Time complexity is O(m * log (n)) where m is the number of edges in the graph and n is number of nodes in it.`New`

: Constructor functions for graphs (undirected by default)`NewDSU`

: NewDSU will return an initialised DSU using the value of n which will be treated as the number of elements out of which the DSU is being made`NotExist`

: No description provided.`Topological`

: Assumes that graph given is valid and possible to get a topo ordering. constraints are array of []int{a, b}, representing an edge going from a to b## Types

`DisjointSetUnion`

: No description provided.`DisjointSetUnionElement`

: No description provided.`Edge`

: No description provided.`Graph`

: No description provided.`Item`

: No description provided.`WeightedGraph`

: No description provided.hashmap## Functions:

`Make`

: Make creates a new HashMap instance with input size and capacity`New`

: New return new HashMap instance## Types

`HashMap`

: No description provided.kmp## Functions:

`Kmp`

: Kmp Function kmp performing the Knuth-Morris-Pratt algorithm. Prints whether the word/pattern was found and on what position in the text or not. m - current match in text, i - current character in w, c - amount of comparisons.## Types

`Result`

: No description provided.lcm## Functions:

`Lcm`

: Lcm returns the lcm of two numbers using the fact that lcm(a,b) * gcd(a,b) = | a * b |levenshtein## Functions:

`Distance`

: Distance Function that gives Levenshtein Distancelinkedlist## Package linkedlist demonstates different implementations on linkedlists.

## Functions:

`JosephusProblem`

: https://en.wikipedia.org/wiki/Josephus_problem This is a struct-based solution for Josephus problem.`NewCyclic`

: Create new list.`NewDoubly`

: No description provided.`NewNode`

: Create new node.`NewSingly`

: NewSingly returns a new instance of a linked list## Types

`Cyclic`

: No description provided.`Doubly`

: No description provided.`Node`

: No description provided.`Singly`

: No description provided.`testCase`

: No description provided.manacher## Functions:

`LongestPalindrome`

: No description provided.math## Package math is a package that contains mathematical algorithms and its different implementations.

## Functions:

`IsPowOfTwoUseLog`

: IsPowOfTwoUseLog This function checks if a number is a power of two using the logarithm. The limiting degree can be from 0 to 63. See alternatives in the binary package.`Phi`

: Phi is the Euler totient function. This function computes the number of numbers less then n that are coprime with n.max## Functions:

`Bitwise`

: Bitwise computes using bitwise operator the maximum of all the integer input and returns it`Int`

: Int is a function which returns the maximum of all the integers provided as arguments.maxsubarraysum## Package maxsubarraysum is a package containing a solution to a common problem of finding max contiguous sum within a array of ints.

## Functions:

`MaxSubarraySum`

: MaxSubarraySum returns the maximum subarray summin## Functions:

`Bitwise`

: Bitwise This function returns the minimum integer using bit operations`Int`

: Int is a function which returns the minimum of all the integers provided as arguments.modular## Functions:

`Exponentiation`

: Exponentiation returns base^exponent % mod`Inverse`

: Inverse Modular function`Multiply64BitInt`

: Multiply64BitInt Checking if the integer multiplication overflowsmoserdebruijnsequence## Functions:

`MoserDeBruijnSequence`

: No description provided.nested## Package nested provides functions for testing strings proper brackets nesting.

## Functions:

`IsBalanced`

: IsBalanced returns true if provided input string is properly nested. Input is a sequence of brackets: '(', ')', '[', ']', '{', '}'. A sequence of brackets`s`

is considered properly nested if any of the following conditions are true: -`s`

is empty; -`s`

has the form (U) or [U] or {U} where U is a properly nested string; -`s`

has the form VW where V and W are properly nested strings. For example, the string "()()[()]" is properly nested but "[(()]" is not.NoteProviding characters other then brackets would return false, despite brackets sequence in the string. Make sure to filter input before usage.palindrome## Functions:

`IsPalindrome`

: No description provided.pangram## Functions:

`IsPangram`

: No description provided.pascal## Functions:

`GenerateTriangle`

: GenerateTriangle This function generates a Pascal's triangle of n linespassword## Package password contains functions to help generate random passwords

## Functions:

`Generate`

: Generate returns a newly generated passwordpermutation## Functions:

`GenerateElementSet`

: No description provided.`Heaps`

: Heap's Algorithm for generating all permutations of n objectspi## spigotpi_test.go description: Test for Spigot Algorithm for the Digits of Pi author(s) red_byte see spigotpi.go

## Functions:

`MonteCarloPi`

: No description provided.`Spigot`

: No description provided.polybius## Package polybius is encrypting method with polybius square ref: https://en.wikipedia.org/wiki/Polybius_square#Hybrid_Polybius_Playfair_Cipher

## Functions:

`NewPolybius`

: NewPolybius returns a pointer to object of Polybius. If the size of "chars" is longer than "size", "chars" are truncated to "size".## Types

`Polybius`

: No description provided.power## Functions:

`IterativePower`

: IterativePower is iterative O(logn) function for pow(x, y)`RecursivePower`

: RecursivePower is recursive O(logn) function for pow(x, y)`RecursivePower1`

: RecursivePower1 is recursive O(n) function for pow(x, y)`UsingLog`

: No description provided.prime## Functions:

`Factorize`

: Factorize is a function that computes the exponents of each prime in the prime factorization of n`Generate`

: Generate returns a int slice of prime numbers up to the limit`GenerateChannel`

: Generate generates the sequence of integers starting at 2 and sends it to the channel`ch`

`MillerRabinTest`

: MillerRabinTest Probabilistic test for primality of an integer based of the algorithm devised by Miller and Rabin.`MillerTest`

: MillerTest This is the intermediate step that repeats within the miller rabin primality test for better probabilitic chances of receiving the correct result.`NaiveApproach`

: NaiveApproach checks if an integer is prime or not. Returns a bool.`PairApproach`

: PairApproach checks primality of an integer and returns a bool. More efficient than the naive approach as number of iterations are less.`Sieve`

: Sieve Sieving the numbers that are not prime from the channel - basically removing them from the channelspythagoras## Functions:

`Distance`

: Distance calculates the distance between to vectors with the Pythagoras theorem## Types

`Vector`

: No description provided.queue## Functions:

`BackQueue`

: BackQueue return the Back value`DeQueue`

: DeQueue it will be removed the first value that added into the list`EnQueue`

: EnQueue it will be added new value into our list`FrontQueue`

: FrontQueue return the Front value`IsEmptyQueue`

: IsEmptyQueue check our list is empty or not`LenQueue`

: LenQueue will return the length of the queue list## Types

`LQueue`

: No description provided.`Node`

: No description provided.`Queue`

: No description provided.rsa## Package rsa shows a simple implementation of RSA algorithm

## Functions:

`Decrypt`

: Decrypt decrypts encrypted rune slice based on the RSA algorithm`Encrypt`

: Encrypt encrypts based on the RSA algorithm - uses modular exponentitation in math directorysearch## Functions:

`BoyerMoore`

: Implementation of boyer moore string search O(l) where l=len(text)`Naive`

: Implementation of naive string search O(n*m) where n=len(txt) and m=len(pattern)segmenttree## Functions:

`NewSegmentTree`

: No description provided.## Types

`SegmentTree`

: No description provided.set## package set implements a Set using a golang map. This implies that only the types that are accepted as valid map keys can be used as set elements. For instance, do not try to Add a slice, or the program will panic.

## Functions:

`New`

: New gives new set.sha256## Functions:

`Hash`

: Hash hashes the input message using the sha256 hashing function, and return a 32 byte array. The implementation follows the RGC6234 standard, which is documented at https://datatracker.ietf.org/doc/html/rfc6234sort## Package sort a package for demonstrating sorting algorithms in Go

## Functions:

`Comb`

: No description provided.`Count`

: No description provided.`Exchange`

: No description provided.`HeapSort`

: No description provided.`ImprovedSimpleSort`

: ImprovedSimpleSort is a improve SimpleSort by skipping an unnecessary comparison of the first and last. This improved version is more similar to implementation of insertion sort`InsertionSort`

: No description provided.`Mergesort`

: Mergesort Perform mergesort on a slice of ints`Pigeonhole`

: Pigeonhole sorts a slice using pigeonhole sorting algorithm.`QuickSort`

: QuickSort Sorts the entire array`QuickSortRange`

: QuickSortRange Sorts the specified range within the array`RadixSort`

: No description provided.`SelectionSort`

: No description provided.`ShellSort`

: No description provided.`SimpleSort`

: No description provided.## Types

`Int`

:Methods:

`More`

: No description provided.`MaxHeap`

: No description provided.stack## Types

`Node`

: No description provided.`SList`

: No description provided.`Stack`

: No description provided.transposition## Functions:

`Decrypt`

: No description provided.`Encrypt`

: No description provided.## Types

`KeyMissingError`

: No description provided.`NoTextToEncryptError`

: No description provided.trie## Package trie provides Trie data structures in golang. Wikipedia: https://en.wikipedia.org/wiki/Trie

## Functions:

`NewNode`

: NewNode creates a new Trie node with initialized children map.## Types

`Node`

: No description provided.xor## Package xor is an encryption algorithm that operates the exclusive disjunction(XOR) ref: https://en.wikipedia.org/wiki/XOR_cipher

## Functions:

`Decrypt`

: Decrypt decrypts with Xor encryption`Encrypt`

: Encrypt encrypts with Xor encryption after converting each character to byte The returned value might not be readable because there is no guarantee which is within the ASCII range If using other type such as string, []int, or some other types, add the statements for converting the type to []byte.