Skip to content
/ Go Public
forked from TheAlgorithms/Go

Algorithms and Data Structures implemented in Go for beginners, following best practices.

License

Notifications You must be signed in to change notification settings

Stars1233/Go

 
 

Repository files navigation

The Algorithms - Go

Gitpod Ready-to-Code  Continuous Integration codecov godocmd   update_directory_md Discord chat 

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:
  1. Advanced: Advanced Function performing the Advanced Aho-Corasick algorithm. Finds and prints occurrences of each pattern.
  2. AhoCorasick: AhoCorasick Function performing the Basic Aho-Corasick algorithm. Finds and prints occurrences of each pattern.
  3. ArrayUnion: ArrayUnion Concats two arrays of int's into one.
  4. BoolArrayCapUp: BoolArrayCapUp Dynamically increases an array size of bool's by 1.
  5. BuildAc: Functions that builds Aho Corasick automaton.
  6. BuildExtendedAc: BuildExtendedAc Functions that builds extended Aho Corasick automaton.
  7. ComputeAlphabet: ComputeAlphabet Function that returns string of all the possible characters in given patterns.
  8. ConstructTrie: ConstructTrie Function that constructs Trie as an automaton for a set of reversed & trimmed strings.
  9. Contains: Contains Returns 'true' if array of int's 's' contains int 'e', 'false' otherwise.
  10. CreateNewState: CreateNewState Automaton function for creating a new state 'state'.
  11. CreateTransition: CreateTransition Creates a transition for function σ(state,letter) = end.
  12. GetParent: GetParent Function that finds the first previous state of a state and returns it. Used for trie where there is only one parent.
  13. GetTransition: GetTransition Returns ending state for transition σ(fromState,overChar), '-1' if there is none.
  14. GetWord: GetWord Function that returns word found in text 't' at position range 'begin' to 'end'.
  15. IntArrayCapUp: IntArrayCapUp Dynamically increases an array size of int's by 1.
  16. StateExists: StateExists Checks if state 'state' exists. Returns 'true' if it does, 'false' otherwise.

Types
  1. Result: No description provided.

armstrong
Functions:
  1. IsArmstrong: No description provided.

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

Functions:
  1. Abs: Abs returns absolute value using binary operation Principle of operation: 1) Get the mask by right shift by the base 2) Base is the size of an integer variable in bits, for example, for int32 it will be 32, for int64 it will be 64 3) For negative numbers, above step sets mask as 1 1 1 1 1 1 1 1 and 0 0 0 0 0 0 0 0 for positive numbers. 4) Add the mask to the given number. 5) XOR of mask + n and mask gives the absolute value.
  2. BitCounter: BitCounter - The function returns the number of set bits for an unsigned integer number
  3. FastInverseSqrt: FastInverseSqrt assumes that argument is always positive, and it does not deal with negative numbers. The "magic" number 0x5f3759df is hex for 1597463007 in decimals. The math.Float32bits is alias to *(*uint32)(unsafe.Pointer(&f)) and math.Float32frombits is to *(*float32)(unsafe.Pointer(&b)).
  4. 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.
  5. 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
  6. LogBase2: LogBase2 Finding the exponent of n = 2**x using bitwise operations (logarithm in base 2 of n) See more
  7. MeanUsingAndXor: MeanUsingAndXor This function finds arithmetic mean using "AND" and "XOR" operations
  8. MeanUsingRightShift: MeanUsingRightShift This function finds arithmetic mean using right shift
  9. 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.
  10. SequenceGrayCode: SequenceGrayCode The function generates an "Gray code" sequence of length n
  11. Sqrt: No description provided.
  12. XorSearchMissingNumber: XorSearchMissingNumber This function finds a missing number in a sequence

cache
Functions:
  1. NewLFU: NewLFU init the LFU cache with capacity
  2. NewLRU: NewLRU represent initiate lru cache with capacity

Types
  1. LFU: No description provided.

  2. LRU: No description provided.


caesar
Package caesar is the shift cipher description: Caesar cipher details : Caesar cipher is a type of substitution cipher in which each letter in the plaintext is shifted a certain number of places down the alphabet. time complexity: O(n) space complexity: O(n) ref: https://en.wikipedia.org/wiki/Caesar_cipher

Functions:
  1. Decrypt: Decrypt decrypts by left shift of "key" each character of "input"
  2. Encrypt: Encrypt encrypts by right shift of "key" each character of "input"
  3. FuzzCaesar: No description provided.

catalan
Functions:
  1. CatalanNumber: CatalanNumber This function returns the nth Catalan number

checksum
Package checksum describes algorithms for finding various checksums

Functions:
  1. CRC8: CRC8 calculates CRC8 checksum of the given data.
  2. Luhn: Luhn validates the provided data using the Luhn algorithm.

Types
  1. CRCModel: No description provided.

circularqueue
Package queue provides an implementation of a circular queue data structure.

Functions:
  1. NewCircularQueue: NewCircularQueue creates a new CircularQueue with the given size. Returns an error if the size is less than or equal to 0.

Types
  1. CircularQueue: No description provided.

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

Functions:
  1. 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
  1. Graph: No description provided.

combination
Package combination ...

Functions:
  1. Start: Start ...

Types
  1. Combinations: No description provided.

compression
/*

rlecoding.go description: run length encoding and decoding details: Run-length encoding (RLE) is a simple form of data compression in which runs of data are stored as a single data value and count, rather than as the original run. This is useful when the data contains many repeated values. For example, the data "WWWWWWWWWWWWBWWWWWWWWWWWWBBB" can be compressed to "12W1B12W3B". The algorithm is simple and can be implemented in a few lines of code. time complexity: O(n) space complexity: O(n) ref: https://en.wikipedia.org/wiki/Run-length_encoding author(s) ddaniel27


Functions:
  1. HuffDecode: HuffDecode recursively decodes the binary code in, by traversing the Huffman compression tree pointed by root. current stores the current node of the traversing algorithm. out stores the current decoded string.
  2. HuffEncode: HuffEncode encodes the string in by applying the mapping defined by codes.
  3. HuffEncoding: HuffEncoding recursively traverses the Huffman tree pointed by node to obtain the map codes, that associates a rune with a slice of booleans. Each code is prefixed by prefix and left and right children are labelled with the booleans false and true, respectively.
  4. HuffTree: HuffTree returns the root Node of the Huffman tree by compressing listfreq. The compression produces the most optimal code lengths, provided listfreq is ordered, i.e.: listfreq[i] <= listfreq[j], whenever i < j.
  5. RLEdecode: RLEdecode takes a run-length encoded string and returns the original string
  6. RLEdecodebytes: RLEdecodebytes takes a run-length encoded byte slice and returns the original byte slice
  7. RLEncode: RLEncode takes a string and returns its run-length encoding
  8. RLEncodebytes: RLEncodebytes takes a byte slice and returns its run-length encoding as a byte slice

Types
  1. Node: No description provided.

  2. SymbolFreq: No description provided.


compression_test
Functions:
  1. SymbolCountOrd: SymbolCountOrd computes sorted symbol-frequency list of input message

conversion
Package conversion is a package of implementations which converts one data structure to another.

Functions:
  1. 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
  2. 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
  3. BinaryToDecimal: BinaryToDecimal() function that will take Binary number as string, and return its Decimal equivalent as an integer.
  4. DecimalToBinary: DecimalToBinary() function that will take Decimal number as int, and return its Binary equivalent as a string.
  5. FuzzBase64Encode: No description provided.
  6. HEXToRGB: HEXToRGB splits an RGB input (e.g. a color in hex format; 0x) into the individual components: red, green and blue
  7. IntToRoman: IntToRoman converts an integer value to a roman numeral string. An error is returned if the integer is not between 1 and 3999.
  8. 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
  9. Reverse: Reverse() function that will take string, and returns the reverse of that string.
  10. RomanToInt: RomanToInt 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.

deque
Package deque implements a Double Ended Queue data structure.

Functions:
  1. New: New returns a new DoublyEndedQueue.

Types
  1. DoublyEndedQueue: No description provided.

deque_test
Types
  1. QueryStructure: No description provided.

  2. TestCaseData: No description provided.


diffiehellman
Package diffiehellman implements Diffie-Hellman Key Exchange Algorithm description: Diffie-Hellman key exchange details : Diffie-Hellman key exchange is a method of securely exchanging cryptographic keys over a public channel by combining private keys of two parties to generate a shared secret key. time complexity: O(log(n)) space complexity: O(1) for more information watch : https://www.youtube.com/watch?v=NmM9HA2MQGI

Functions:
  1. GenerateMutualKey: GenerateMutualKey : generates a mutual key that can be used by only alice and bob mutualKey = (shareKey^prvKey)%primeNumber
  2. GenerateShareKey: GenerateShareKey : generates a key using client private key , generator and primeNumber this key can be made public shareKey = (g^key)%primeNumber

dsa
/*

dsa.go description: DSA encryption and decryption including key generation details: DSA wiki author(s): ddaniel27


Functions:
  1. New: New creates a new DSA instance
  2. Sign: Sign is signature generation for DSA 1. Choose a random integer k from the range [1, q-1] 2. Compute r = (g^k mod p) mod q 3. Compute s = (k^-1 * (H(m) + x*r)) mod q
  3. Verify: Verify is signature verification for DSA 1. Compute w = s^-1 mod q 2. Compute u1 = (H(m) * w) mod q 3. Compute u2 = (r * w) mod q 4. Compute v = ((g^u1 * y^u2) mod p) mod q 5. If v == r, the signature is valid

dynamic
filename: traprainwater.go description: Provides a function to calculate the amount of trapped rainwater between bars represented by an elevation map using dynamic programming. details: The TrapRainWater function calculates the amount of trapped rainwater between the bars represented by the given elevation map. It uses dynamic programming to precompute the maximum height of bars to the left and right of each position. Then, it iterates through the array to calculate the amount of trapped rainwater at each position based on the minimum of the left and right maximum heights. Finally, it sums up the trapped rainwater for all positions and returns the total amount. time complexity: O(n) space complexity: O(n) author(s) TruongNhanNguyen (SOZEL) binomialcoefficient.go description: Implementation of the binomial coefficient using dynamic programming details: The binomial coefficient C(n, k) is the number of ways to choose a subset of k elements from a set of n elements. The binomial coefficient is calculated using the formula C(n, k) = C(n-1, k-1) + C(n-1, k) with base cases C(n, 0) = C(n, n) = 1. time complexity: O(nk) where n is the number of elements and k is the number of elements to choose space complexity: O(nk) where n is the number of elements and k is the number of elements to choose fibonacci.go description: Implementation of the Fibonacci sequence using dynamic programming time complexity: O(n) space complexity: O(1) Package dynamic is a package of certain implementations of dynamically run algorithms. See https://leetcode.com/problems/unique-paths/ time complexity: O(mn) where m and n are the dimensions of the grid space complexity: O(mn) where m and n are the dimensions of the grid author: Rares Mateizer (https://github.com/rares985)

Functions:
  1. Abbreviation: Returns true if it is possible to make a equals b (if b is an abbreviation of a), returns false otherwise
  2. Bin2: Bin2 function
  3. CoinChange: CoinChange finds the number of possible combinations of coins of different values which can get to the target amount.
  4. CutRodDp: CutRodDp solve the same problem using dynamic programming
  5. CutRodRec: CutRodRec solve the problem recursively: initial approach
  6. DiceThrow: DiceThrow returns the number of ways to get sum sum using m dice with n faces
  7. 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.
  8. EditDistanceRecursive: EditDistanceRecursive is a naive implementation with exponential time complexity.
  9. EggDropping: EggDropping finds the minimum number of attempts needed to find the critical floor with eggs number of eggs and floors number of floors
  10. IsInterleave: IsInterleave checks if string s1 and s2 can be interleaved to form string s3
  11. IsMatch: IsMatch checks if the string s matches the wildcard pattern p
  12. IsSubsetSum: No description provided.
  13. Knapsack: Knapsack solves knapsack problem return maxProfit
  14. LongestArithmeticSubsequence: LongestArithmeticSubsequence returns the length of the longest arithmetic subsequence
  15. LongestCommonSubsequence: LongestCommonSubsequence function
  16. LongestIncreasingSubsequence: LongestIncreasingSubsequence returns the longest increasing subsequence where all elements of the subsequence are sorted in increasing order
  17. LongestIncreasingSubsequenceGreedy: LongestIncreasingSubsequenceGreedy is a function to find the longest increasing subsequence in a given array using a greedy approach. The dynamic programming approach is implemented alongside this one. Worst Case Time Complexity: O(nlogn) Auxiliary Space: O(n), where n is the length of the array(slice). Reference: https://www.geeksforgeeks.org/construction-of-longest-monotonically-increasing-subsequence-n-log-n/
  18. LongestPalindromicSubstring: LongestPalindromicSubstring returns the longest palindromic substring in the input string
  19. LpsDp: LpsDp function
  20. LpsRec: LpsRec function
  21. MatrixChainDp: MatrixChainDp function
  22. MatrixChainRec: MatrixChainRec function
  23. Max: Max function - possible duplicate
  24. MaxCoins: MaxCoins returns the maximum coins we can collect by bursting the balloons
  25. MaxSubArraySum: MaxSubArraySum returns the sum of the maximum subarray in the input array
  26. NthCatalanNumber: NthCatalan returns the n-th Catalan Number Complexity: O(n²)
  27. NthFibonacci: NthFibonacci returns the nth Fibonacci Number
  28. OptimalBST: OptimalBST returns the minimum cost of constructing a Binary Search Tree
  29. PartitionProblem: PartitionProblem checks whether the given set can be partitioned into two subsets such that the sum of the elements in both subsets is the same.
  30. TilingProblem: TilingProblem returns the number of ways to tile a 2xN grid using 2x1 dominoes
  31. TrapRainWater: TrapRainWater calculates the amount of trapped rainwater between the bars represented by the given elevation map. It uses dynamic programming to precompute the maximum height of bars to the left and right of each position. Then, it iterates through the array to calculate the amount of trapped rainwater at each position based on the minimum of the left and right maximum heights. Finally, it sums up the trapped rainwater for all positions and returns the total amount.
  32. UniquePaths: UniquePaths implements the solution to the "Unique Paths" problem
  33. WordBreak: WordBreak checks if the input string can be segmented into words from a dictionary

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

Types
  1. DynamicArray: No description provided.

factorial
Package factorial describes algorithms Factorials calculations.

Functions:
  1. Iterative: Iterative returns the iteratively brute forced factorial of n
  2. Recursive: Recursive This function recursively computes the factorial of a number
  3. UsingTree: UsingTree This function finds the factorial of a number using a binary tree

fenwicktree
Fenwick Tree Data Structure for efficient range queries on an array of integers. Also known as Binary Indexed Tree. It can query the sum of any range of the array and can update the array at a specific position by adding a value to it (point update). Build: O(N) Query: O(log(N)) Update: O(log(N)) reference: https://brilliant.org/wiki/fenwick-tree/

Functions:
  1. NewFenwickTree: NewFenwickTree creates a new Fenwick tree, initializes bit with the values of the array. Note that the queries and updates should have one based indexing.

Types
  1. FenwickTree: No description provided.

fibonacci
Functions:
  1. Formula: Formula This function calculates the n-th fibonacci number using the formula Attention! Tests for large values fall due to rounding error of floating point numbers, works well, only on small numbers
  2. Matrix: Matrix This function calculates the n-th fibonacci number using the matrix method. See
  3. Recursive: Recursive calculates the n-th fibonacci number recursively by adding the previous two Fibonacci numbers. This algorithm is extremely slow for bigger numbers, but provides a simpler implementation.

gcd
Functions:
  1. Extended: Extended simple extended gcd
  2. ExtendedIterative: ExtendedIterative finds and returns gcd(a, b), x, y satisfying ax + by = gcd(a, b).
  3. ExtendedRecursive: ExtendedRecursive finds and returns gcd(a, b), x, y satisfying ax + by = gcd(a, b).
  4. Iterative: Iterative Faster iterative version of GcdRecursive without holding up too much of the stack
  5. Recursive: Recursive finds and returns the greatest common divisor of a given integer.
  6. TemplateBenchmarkExtendedGCD: No description provided.
  7. TemplateBenchmarkGCD: No description provided.
  8. TemplateTestExtendedGCD: No description provided.
  9. TemplateTestGCD: No description provided.

generateparentheses
Functions:
  1. 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:
  1. GeneticString: GeneticString generates PopulationItem 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
  1. Conf: No description provided.

  2. PopulationItem: No description provided.

  3. Result: No description provided.


geometry
Package geometry contains geometric algorithms Package geometry contains geometric algorithms

Functions:
  1. Distance: Distance calculates the shortest distance between two points.
  2. EuclideanDistance: EuclideanDistance returns the Euclidean distance between points in any n dimensional Euclidean space.
  3. IsParallel: IsParallel checks if two lines are parallel or not.
  4. IsPerpendicular: IsPerpendicular checks if two lines are perpendicular or not.
  5. PointDistance: 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.
  6. Section: 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.
  7. Slope: Slope calculates the slope (gradient) of a line.
  8. YIntercept: YIntercept calculates the Y-Intercept of a line from a specific Point.

Types
  1. EuclideanPoint: No description provided.

  2. Line: No description provided.

  3. Point: No description provided.


graph
Package graph provides algorithms to analyze graph structures. Package graph demonstrates Graph search algorithms reference: https://en.wikipedia.org/wiki/Tree_traversal

Functions:
  1. ArticulationPoint: ArticulationPoint identifies articulation points in a graph. It returns a boolean slice where each element indicates whether a vertex is an articulation point. Worst Case Time Complexity: O(|V| + |E|) Auxiliary Space: O(|V|) Reference: https://en.wikipedia.org/wiki/Biconnected_component and https://cptalks.quora.com/Cut-Vertex-Articulation-point
  2. 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}) where |V| is the number of vertices and |E| is the number of edges in the graph and b is the branching factor of the graph (the average number of successors of a node). d is the depth of the goal node. Worst-case space complexity O(|V|)=O(b^{d})}O(|V|)=O(b^{d}) where |V| is the number of vertices and |E| is the number of edges in the graph and b is the branching factor of the graph (the average number of successors of a node). d is the depth of the goal node. reference: https://en.wikipedia.org/wiki/Breadth-first_search
  3. DepthFirstSearch: No description provided.
  4. DepthFirstSearchHelper: No description provided.
  5. EdmondKarp: No description provided.
  6. FindPath: Returns a mapping of vertices as path, if there is any from source to sink Otherwise, returns nil
  7. FloydWarshall: FloydWarshall Returns all pair's shortest path using Floyd Warshall algorithm
  8. GetIdx: No description provided.
  9. Kahn: Kahn's algorithm computes a topological ordering of a directed acyclic graph (DAG). n is the number of vertices, dependencies is a list of directed edges, where each pair [a, b] represents a directed edge from a to b (i.e. b depends on a). Vertices are assumed to be labelled 0, 1, ..., n-1. If the graph is not a DAG, the function returns nil.
  10. KruskalMST: No description provided.
  11. LowestCommonAncestor: For each node, we will precompute its ancestor above him, its ancestor two nodes above, its ancestor four nodes above, etc. Let's call jump[j][u] is the 2^j-th ancestor above the node u with u in range [0, numbersVertex), j in range [0,MAXLOG). These information allow us to jump from any node to any ancestor above it in O(MAXLOG) time.
  12. New: Constructor functions for graphs (undirected by default)
  13. NewTree: No description provided.
  14. NewUnionFind: Initialise a new union find data structure with s nodes
  15. NotExist: No description provided.
  16. Topological: Topological assumes that graph given is valid and that its possible to get a topological ordering. constraints are array of []int{a, b}, representing an edge going from a to b

Types
  1. Edge: No description provided.

  2. Graph: No description provided.

  3. Item: No description provided.

  4. Query: No description provided.

  5. Tree: No description provided.

  6. TreeEdge: No description provided.

  7. UnionFind: No description provided.

  8. WeightedGraph: No description provided.

  9. minEdge:

    Methods:

    1. Len: No description provided.

guid
Package guid provides facilities for generating random globally unique identifiers.

Functions:
  1. New: New returns a randomly generated global unique identifier.

hamming
Functions:
  1. Distance: No description provided.

hashmap
Functions:
  1. DefaultNew: DefaultNew returns a new HashMap instance with default values
  2. New: New creates a new HashMap instance with the specified size and capacity

Types
  1. HashMap: No description provided.

heap
Functions:
  1. New: New gives a new heap object.
  2. NewAny: NewAny gives a new heap object. element can be anything, but must provide less function.

Types
  1. Heap: No description provided.

heap_test
Types
  1. testInt:

    Methods:

    1. Less: No description provided.
  2. testStudent:

    Methods:

    1. Less: No description provided.

horspool
Functions:
  1. Horspool: No description provided.

kmp
Functions:
  1. Kmp: Kmp Function kmp performing the Knuth-Morris-Pratt algorithm.

Types
  1. args: No description provided.

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

levenshtein
Functions:
  1. Distance: Distance Function that gives Levenshtein Distance

linkedlist
Package linkedlist demonstrates different implementations on linkedlists.

Functions:
  1. JosephusProblem: https://en.wikipedia.org/wiki/Josephus_problem This is a struct-based solution for Josephus problem.
  2. NewCyclic: Create new list.
  3. NewDoubly: No description provided.
  4. NewNode: Create new node.
  5. NewSingly: NewSingly returns a new instance of a linked list

Types
  1. Cyclic: No description provided.

  2. Doubly: No description provided.

  3. Node: No description provided.

  4. Singly: No description provided.

  5. testCase: No description provided.


manacher
Functions:
  1. LongestPalindrome: No description provided.

math
Package math is a package that contains mathematical algorithms and its different implementations. filename : krishnamurthy.go description: A program which contains the function that returns true if a given number is Krishnamurthy number or not. details: A number is a Krishnamurthy number if the sum of all the factorials of the digits is equal to the number. Ex: 1! = 1, 145 = 1! + 4! + 5! time complexity: O(log n) space complexity: O(1) author(s): GooMonk see krishnamurthy_test.go

Functions:
  1. Abs: Abs returns absolute value
  2. AliquotSum: This function returns s(n) for given number
  3. Combinations: C is Binomial Coefficient function This function returns C(n, k) for given n and k
  4. Cos: Cos returns the cosine of the radian argument x. See more Based on the idea of Bhaskara approximation of cos(x)
  5. DefaultPolynomial: DefaultPolynomial is the commonly used polynomial g(x) = (x^2 + 1) mod n
  6. FindKthMax: FindKthMax returns the kth large element given an integer slice with nil error if found and returns -1 with error search.ErrNotFound if not found. NOTE: The nums slice gets mutated in the process.
  7. FindKthMin: FindKthMin returns kth small element given an integer slice with nil error if found and returns -1 with error search.ErrNotFound if not found. NOTE: The nums slice gets mutated in the process.
  8. IsAutomorphic: No description provided.
  9. IsKrishnamurthyNumber: IsKrishnamurthyNumber returns if the provided number n is a Krishnamurthy number or not.
  10. IsPerfectNumber: Checks if inNumber is a perfect number
  11. 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.
  12. Lerp: Lerp or Linear interpolation This function will return new value in 't' percentage between 'v0' and 'v1'
  13. LiouvilleLambda: Lambda is the liouville function This function returns λ(n) for given number
  14. Mean: No description provided.
  15. Median: No description provided.
  16. Mode: No description provided.
  17. Mu: Mu is the Mobius function This function returns μ(n) for given number
  18. Phi: Phi is the Euler totient function. This function computes the number of numbers less then n that are coprime with n.
  19. PollardsRhoFactorization: PollardsRhoFactorization is an implementation of Pollard's rho factorization algorithm using the default parameters x = y = 2
  20. PronicNumber: PronicNumber returns true if argument passed to the function is pronic and false otherwise.
  21. Sin: Sin returns the sine of the radian argument x. See more
  22. SumOfProperDivisors: Returns the sum of proper divisors of inNumber.

matrix
filename: strassenmatrixmultiply.go description: Implements matrix multiplication using the Strassen algorithm. details: This program takes two matrices as input and performs matrix multiplication using the Strassen algorithm, which is an optimized divide-and-conquer approach. It allows for efficient multiplication of large matrices. time complexity: O(n^2.81) space complexity: O(n^2) author(s): Mohit Raghav(https://github.com/mohit07raghav19) See strassenmatrixmultiply_test.go for test cases

Functions:
  1. IsValid: IsValid checks if the input matrix has consistent row lengths.
  2. New: NewMatrix creates a new Matrix based on the provided arguments.
  3. NewFromElements: NewFromElements creates a new Matrix from the given elements.

Types
  1. Matrix: No description provided.

matrix_test
Functions:
  1. MakeRandomMatrix: No description provided.

max
Functions:
  1. Bitwise: Bitwise computes using bitwise operator the maximum of all the integer input and returns it
  2. 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:
  1. MaxSubarraySum: MaxSubarraySum returns the maximum subarray sum

md5
Functions:
  1. Hash: Hash computes the MD5 hash of the input message

min
Functions:
  1. Bitwise: Bitwise This function returns the minimum integer using bit operations
  2. Int: Int is a function which returns the minimum of all the integers provided as arguments.

modular
Functions:
  1. Exponentiation: Exponentiation returns base^exponent % mod
  2. Inverse: Inverse Modular function
  3. Multiply64BitInt: Multiply64BitInt Checking if the integer multiplication overflows

moserdebruijnsequence
Functions:
  1. MoserDeBruijnSequence: No description provided.

nested
Package nested provides functions for testing strings proper brackets nesting.

Functions:
  1. IsBalanced: No description provided.

palindrome
Functions:
  1. IsPalindrome: No description provided.
  2. IsPalindromeRecursive: No description provided.

pangram
Functions:
  1. IsPangram: No description provided.

parenthesis
Functions:
  1. Parenthesis: Parenthesis algorithm checks if every opened parenthesis is closed correctly. When parcounter is less than 0 when a closing parenthesis is detected without an opening parenthesis that surrounds it and parcounter will be 0 if all open parenthesis are closed correctly.

pascal
Functions:
  1. GenerateTriangle: GenerateTriangle This function generates a Pascal's triangle of n lines

password
Functions:
  1. Generate: Generate returns a newly generated password

permutation
Functions:
  1. GenerateElementSet: No description provided.
  2. Heaps: Heap's Algorithm for generating all permutations of n objects
  3. NextPermutation: No description provided.

pi
spigotpi_test.go description: Test for Spigot Algorithm for the Digits of Pi author(s) red_byte see spigotpi.go

Functions:
  1. MonteCarloPi: No description provided.
  2. MonteCarloPiConcurrent: MonteCarloPiConcurrent approximates the value of pi using the Monte Carlo method. Unlike the MonteCarloPi function (first version), this implementation uses goroutines and channels to parallelize the computation. More details on the Monte Carlo method available at https://en.wikipedia.org/wiki/Monte_Carlo_method. More details on goroutines parallelization available at https://go.dev/doc/effective_go#parallel.
  3. Spigot: No description provided.

polybius
Package polybius is encrypting method with polybius square description: Polybius square details : The Polybius algorithm is a simple algorithm that is used to encode a message by converting each letter to a pair of numbers. time complexity: O(n) space complexity: O(n) ref: https://en.wikipedia.org/wiki/Polybius_square#Hybrid_Polybius_Playfair_Cipher

Functions:
  1. FuzzPolybius: No description provided.
  2. NewPolybius: NewPolybius returns a pointer to object of Polybius. If the size of "chars" is longer than "size", "chars" are truncated to "size".

Types
  1. Polybius: No description provided.

power
Functions:
  1. IterativePower: IterativePower is iterative O(logn) function for pow(x, y)
  2. RecursivePower: RecursivePower is recursive O(logn) function for pow(x, y)
  3. RecursivePower1: RecursivePower1 is recursive O(n) function for pow(x, y)
  4. UsingLog: No description provided.

prime
sieve2.go - Sieve of Eratosthenes
  • Algorithm to generate prime numbers up to a limit
  • time complexity: O(n log log n)
  • space complexity: O(n)
  • Author: ddaniel27

Functions:
  1. Factorize: Factorize is a function that computes the exponents of each prime in the prime factorization of n
  2. Generate: Generate returns a int slice of prime numbers up to the limit
  3. GenerateChannel: Generate generates the sequence of integers starting at 2 and sends it to the channel ch
  4. MillerRabinDeterministic: MillerRabinDeterministic is a Deterministic version of the Miller-Rabin test, which returns correct results for all valid int64 numbers.
  5. MillerRabinProbabilistic: MillerRabinProbabilistic is a probabilistic test for primality of an integer based of the algorithm devised by Miller and Rabin.
  6. MillerRandomTest: MillerRandomTest This is the intermediate step that repeats within the miller rabin primality test for better probabilitic chances of receiving the correct result with random witnesses.
  7. MillerTest: MillerTest tests whether num is a strong probable prime to a witness. Formally: a^d ≡ 1 (mod n) or a^(2^r * d) ≡ -1 (mod n), 0 <= r <= s
  8. MillerTestMultiple: MillerTestMultiple is like MillerTest but runs the test for multiple witnesses.
  9. OptimizedTrialDivision: OptimizedTrialDivision checks primality of an integer using an optimized trial division method. The optimizations include not checking divisibility by the even numbers and only checking up to the square root of the given number.
  10. Sieve: Sieve Sieving the numbers that are not prime from the channel - basically removing them from the channels
  11. SieveEratosthenes: No description provided.
  12. TrialDivision: TrialDivision tests whether a number is prime by trying to divide it by the numbers less than it.
  13. Twin: This function returns twin prime for given number returns (n + 2) if both n and (n + 2) are prime -1 otherwise

problem1
/**
  • Problem 1 - Multiples of 3 and 5
  • @see {@link https://projecteuler.net/problem=1}
  • If we list all the natural numbers below 10 that are multiples of 3 or 5,
  • we get 3, 5, 6 and 9. The sum of these multiples is 23.
  • Find the sum of all the multiples of 3 or 5 below 1000.
  • @author ddaniel27

Functions:
  1. Problem1: No description provided.

problem10
/**
  • Problem 10 - Summation of primes
  • @see {@link https://projecteuler.net/problem=10}
  • The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
  • Find the sum of all the primes below two million.
  • @author ddaniel27

Functions:
  1. Problem10: No description provided.

problem11
/**
  • Problem 11 - Largest product in a grid
  • @see {@link https://projecteuler.net/problem=11}
  • In the 20×20 grid below, four numbers along a diagonal line have been marked in red.
  • The product of these numbers is 26 × 63 × 78 × 14 = 1788696.
  • What is the greatest product of four adjacent numbers in the same direction
  • (up, down, left, right, or diagonally) in the 20×20 grid?
  • @author ddaniel27

Functions:
  1. Problem11: No description provided.

problem12
/**
  • Problem 12 - Highly divisible triangular number
  • @see {@link https://projecteuler.net/problem=12}
  • The sequence of triangle numbers is generated by adding the natural numbers.
  • So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28.
  • The first ten terms would be:
  • 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
  • Let us list the factors of the first seven triangle numbers:
  • 1: 1
  • 3: 1,3
  • 6: 1,2,3,6
  • 10: 1,2,5,10
  • 15: 1,3,5,15
  • 21: 1,3,7,21
  • 28: 1,2,4,7,14,28
  • We can see that 28 is the first triangle number to have over five divisors.
  • What is the value of the first triangle number to have over five hundred divisors?
  • @author ddaniel27

Functions:
  1. Problem12: No description provided.

problem13
/**

Functions:
  1. Problem13: No description provided.

problem14
/**
  • Problem 14 - Longest Collatz sequence
  • @see {@link https://projecteuler.net/problem=14}
  • The following iterative sequence is defined for the set of positive integers:
  • n → n/2 (n is even)
  • n → 3n + 1 (n is odd)
  • Using the rule above and starting with 13, we generate the following sequence:
  • 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
  • Which starting number, under one million, produces the longest chain?
  • NOTE: Once the chain starts the terms are allowed to go above one million.
  • @author ddaniel27

Functions:
  1. Problem14: No description provided.

problem15
/**
  • Problem 15 - Lattice paths
  • @see {@link https://projecteuler.net/problem=15}
  • Starting in the top left corner of a 2×2 grid,
  • and only being able to move to the right and down,
  • there are exactly 6 routes to the bottom right corner.
  • How many such routes are there through a 20×20 grid?
  • @author ddaniel27

Functions:
  1. Problem15: No description provided.

problem16
/**
  • Problem 16 - Power digit sum
  • @see {@link https://projecteuler.net/problem=16}
  • 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
  • What is the sum of the digits of the number 2^1000?
  • @author ddaniel27

Functions:
  1. Problem16: No description provided.

problem17
/**
  • I put this code in a separate file because it is too long.
  • Also it took me a lot of time to parsing this input from
  • a random html page, so, I don't want to lose it. /**
  • Problem 17 - Number letter counts
  • @see {@link https://projecteuler.net/problem=17}
  • If the numbers 1 to 5 are written out in words: one, two, three, four, five,
  • then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
  • If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words,
  • how many letters would be used?
  • NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two)
  • contains 23 letters and 115 (one hundred and fifteen) contains 20 letters.
  • The use of "and" when writing out numbers is in compliance with British usage.
  • @author ddaniel27

Functions:
  1. Problem17: No description provided.

problem18
/**
  • Problem 18 - Maximum path sum I
  • @see {@link https://projecteuler.net/problem=18}
  • By starting at the top of the triangle below and
  • moving to adjacent numbers on the row below,
  • the maximum total from top to bottom is 23.
  • 3
  • 7 4
  • 2 4 6
  • 8 5 9 3
  • That is, 3 + 7 + 4 + 9 = 23.
  • Find the maximum total from top to bottom of the triangle below:
  • [refer to the problem link]
  • NOTE: As there are only 16384 routes, it is possible
  • to solve this problem by trying every route.
  • However, Problem 67, is the same challenge with a triangle
  • containing one-hundred rows; it cannot be solved by brute force,
  • and requires a clever method! ;o)
  • @author ddaniel27

Functions:
  1. Problem18: No description provided.

Types
  1. DFSNode: No description provided.

  2. Edge: No description provided.

  3. Leaf: No description provided.

  4. Root: No description provided.

  5. Tree: No description provided.


problem19
Functions:
  1. IsLeapYear: No description provided.
  2. Problem19: No description provided.

problem2
/**
  • Problem 2 - Even Fibonacci numbers
  • @see {@link https://projecteuler.net/problem=2}
  • Each new term in the Fibonacci sequence is generated by adding the previous two terms.
  • By starting with 1 and 2, the first 10 terms will be:
  • 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
  • By considering the terms in the Fibonacci sequence whose values do not exceed four million,
  • find the sum of the even-valued terms.
  • @author ddaniel27

Functions:
  1. Problem2: No description provided.

problem20
/**
  • Problem 20 - Factorial digit sum
  • @see {@link https://projecteuler.net/problem=20}
  • n! means n × (n − 1) × ... × 3 × 2 × 1
  • For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
  • and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
  • Find the sum of the digits in the number 100!
  • @author ddaniel27

Functions:
  1. Problem20: No description provided.

problem3
/**
  • Problem 3 - Largest prime factor
  • @see {@link https://projecteuler.net/problem=3}
  • The prime factors of 13195 are 5, 7, 13 and 29.
  • What is the largest prime factor of the number 600851475143 ?
  • @author ddaniel27

Functions:
  1. Problem3: No description provided.

problem4
/**
  • Problem 4 - Largest palindrome product
  • @see {@link https://projecteuler.net/problem=4}
  • A palindromic number reads the same both ways.
  • The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
  • Find the largest palindrome made from the product of two 3-digit numbers.
  • @author ddaniel27

Functions:
  1. Problem4: No description provided.

problem5
/**
  • Problem 5 - Smallest multiple
  • @see {@link https://projecteuler.net/problem=5}
  • 2520 is the smallest number that can be divided by
  • each of the numbers from 1 to 10 without any remainder.
  • What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
  • @author ddaniel27

Functions:
  1. Problem5: No description provided.

problem6
/**
  • Problem 6 - Sum square difference
  • @see {@link https://projecteuler.net/problem=6}
  • The sum of the squares of the first ten natural numbers is,
  • 1^2 + 2^2 + ... + 10^2 = 385
  • The square of the sum of the first ten natural numbers is,
  • (1 + 2 + ... + 10)^2 = 55^2 = 3025
  • Hence the difference between the sum of the squares of the first ten natural numbers
  • and the square of the sum is 3025 − 385 = 2640.
  • Find the difference between the sum of the squares of the first one hundred natural numbers
  • and the square of the sum.
  • @author ddaniel27

Functions:
  1. Problem6: No description provided.

problem7
/**
  • Problem 7 - 10001st prime
  • @see {@link https://projecteuler.net/problem=7}
  • By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13,
  • we can see that the 6th prime is 13.
  • What is the 10 001st prime number?
  • @author ddaniel27

Functions:
  1. Problem7: No description provided.

problem8
/**
  • Problem 8 - Largest product in a series
  • @see {@link https://projecteuler.net/problem=8}
  • The four adjacent digits in the 1000-digit number that
  • have the greatest product are 9 × 9 × 8 × 9 = 5832.
  • Find the thirteen adjacent digits in the 1000-digit number
  • that have the greatest product. What is the value of this product?
  • @author ddaniel27

Functions:
  1. Problem8: No description provided.

problem9
/**
  • Problem 9 - Special Pythagorean triplet
  • @see {@link https://projecteuler.net/problem=9}
  • A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
  • a^2 + b^2 = c^2
  • For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
  • There exists exactly one Pythagorean triplet for which a + b + c = 1000.
  • Find the product abc.
  • @author ddaniel27

Functions:
  1. Problem9: No description provided.

pythagoras
Functions:
  1. Distance: Distance calculates the distance between to vectors with the Pythagoras theorem

Types
  1. Vector: No description provided.

queue
Functions:
  1. BackQueue: BackQueue return the Back value
  2. DeQueue: DeQueue it will be removed the first value that added into the list
  3. EnQueue: EnQueue it will be added new value into our list
  4. FrontQueue: FrontQueue return the Front value
  5. IsEmptyQueue: IsEmptyQueue check our list is empty or not
  6. LenQueue: LenQueue will return the length of the queue list

Types
  1. LQueue: No description provided.

  2. Node: No description provided.

  3. Queue: No description provided.


railfence
railfence.go description: Rail Fence Cipher details: The rail fence cipher is a an encryption algorithm that uses a rail fence pattern to encode a message. it is a type of transposition cipher that rearranges the characters of the plaintext to form the ciphertext. time complexity: O(n) space complexity: O(n) ref: https://en.wikipedia.org/wiki/Rail_fence_cipher

Functions:
  1. Decrypt: No description provided.
  2. Encrypt: No description provided.

rot13
Package rot13 is a simple letter substitution cipher that replaces a letter with the 13th letter after it in the alphabet. description: ROT13 details: ROT13 is a simple letter substitution cipher that replaces a letter with the 13th letter after it in the alphabet. it is a special case of the Caesar cipher time complexity: O(n) space complexity: O(n) ref: https://en.wikipedia.org/wiki/ROT13

Functions:
  1. FuzzRot13: No description provided.

rsa
Package rsa shows a simple implementation of RSA algorithm/*

rsa2.go description: RSA encryption and decryption including key generation details: RSA wiki time complexity: O(n) space complexity: O(1) author(s): ddaniel27


Functions:
  1. Decrypt: Decrypt decrypts encrypted rune slice based on the RSA algorithm
  2. Encrypt: Encrypt encrypts based on the RSA algorithm - uses modular exponentitation in math directory
  3. FuzzRsa: No description provided.
  4. New: New initializes the RSA algorithm returns the RSA object

search
Functions:
  1. BoyerMoore: Implementation of boyer moore string search O(l) where l=len(text)
  2. Naive: Implementation of naive string search O(n*m) where n=len(txt) and m=len(pattern)

segmenttree
Segment Tree Data Structure for efficient range queries on an array of integers. It can query the sum and update the elements to a new value of any range of the array. Build: O(n*log(n)) Query: O(log(n)) Update: O(log(n)) reference: https://cp-algorithms.com/data_structures/segment_tree.html

Functions:
  1. NewSegmentTree: NewSegmentTree returns a new instance of a SegmentTree. It takes an input array of integers representing Array, initializes and builds the SegmentTree.

Types
  1. 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:
  1. New: New gives new set.

sha1
Functions:
  1. Hash: Hash computes the SHA-1 hash of the input message

sha256
Functions:
  1. 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 implements various sorting algorithms. Package sort a package for demonstrating sorting algorithms in Go

Functions:
  1. BinaryInsertion: No description provided.
  2. Bogo: No description provided.
  3. Bubble: Bubble is a simple generic definition of Bubble sort algorithm.
  4. Bucket: Bucket sorts a slice. It is mainly useful when input is uniformly distributed over a range.
  5. Circle: Circle sorts an array using the circle sort algorithm.
  6. Cocktail: Cocktail sort is a variation of bubble sort, operating in two directions (beginning to end, end to beginning)
  7. Comb: Comb is a simple sorting algorithm which is an improvement of the bubble sorting algorithm.
  8. Count: No description provided.
  9. Cycle: Cycle sort is an in-place, unstable sorting algorithm that is particularly useful when sorting arrays containing elements with a small range of values. It is theoretically optimal in terms of the total number of writes to the original array.
  10. Exchange: No description provided.
  11. HeapSort: No description provided.
  12. ImprovedSimple: ImprovedSimple 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
  13. Insertion: No description provided.
  14. Merge: Merge Perform merge sort on a slice
  15. MergeIter: No description provided.
  16. OddEvenSort: OddEvenSort performs the odd-even sort algorithm on the given array. It is a variation of bubble sort that compares adjacent pairs, alternating between odd and even indexed elements in each pass until the array is sorted.
  17. Pancake: Pancake sorts a slice using flip operations, where flip refers to the idea of reversing the slice from index 0 to i.
  18. ParallelMerge: ParallelMerge Perform merge sort on a slice using goroutines
  19. Partition: No description provided.
  20. Patience: No description provided.
  21. Pigeonhole: Pigeonhole sorts a slice using pigeonhole sorting algorithm. NOTE: To maintain time complexity O(n + N), this is the reason for having only Integer constraint instead of Ordered.
  22. Quicksort: Quicksort Sorts the entire array
  23. QuicksortRange: QuicksortRange Sorts the specified range within the array
  24. RadixSort: No description provided.
  25. Selection: No description provided.
  26. Shell: No description provided.
  27. Simple: No description provided.
  28. Stooge: No description provided.
  29. Timsort: Timsort is a simple generic implementation of Timsort algorithm.

Types
  1. MaxHeap: No description provided.

sqrt
Package sqrt contains algorithms and data structures that contains a √n in their complexity

Functions:
  1. NewSqrtDecomposition: Create a new SqrtDecomposition instance with the parameters as specified by SqrtDecomposition comment Assumptions: - len(elements) > 0

Types
  1. SqrtDecomposition: No description provided.

stack
Functions:
  1. NewStack: NewStack creates and returns a new stack.

Types
  1. Array: No description provided.

  2. Node: No description provided.

  3. SList: No description provided.

  4. Stack: No description provided.


strings
Package strings is a package that contains all algorithms that are used to analyse and manipulate strings.

Functions:
  1. CountChars: CountChars counts the number of a times a character has occurred in the provided string argument and returns a map with rune as keys and the count as value.
  2. IsIsogram: No description provided.
  3. IsSubsequence: Returns true if s is subsequence of t, otherwise return false.

transposition
Functions:
  1. Decrypt: No description provided.
  2. Encrypt: No description provided.
  3. FuzzTransposition: No description provided.

tree
For more details check out those links below here: Wikipedia article: https://en.wikipedia.org/wiki/Binary_search_tree authors guuzaa

Functions:
  1. NewAVL: NewAVL creates a novel AVL tree
  2. NewBTree: No description provided.
  3. NewBTreeNode: No description provided.
  4. NewBinarySearch: NewBinarySearch creates a novel Binary-Search tree
  5. NewRB: NewRB creates a new Red-Black Tree

Types
  1. AVL: No description provided.

  2. AVLNode: No description provided.

  3. BSNode: No description provided.

  4. BTree: No description provided.

  5. BTreeNode: No description provided.

  6. BinarySearch: No description provided.

  7. RB: No description provided.

  8. RBNode: No description provided.


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

Functions:
  1. NewNode: NewNode creates a new Trie node with initialized children map.

Types
  1. Node: No description provided.

xor
Package xor is an encryption algorithm that operates the exclusive disjunction(XOR) description: XOR encryption details: The XOR encryption is an algorithm that operates the exclusive disjunction(XOR) on each character of the plaintext with a given key time complexity: O(n) space complexity: O(n) ref: https://en.wikipedia.org/wiki/XOR_cipher

Functions:
  1. Decrypt: Decrypt decrypts with Xor encryption
  2. 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.
  3. FuzzXOR: No description provided.

About

Algorithms and Data Structures implemented in Go for beginners, following best practices.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%