MCPcopy Create free account

hub / github.com/TheAlgorithms/Go / functions

Functions1,378 in github.com/TheAlgorithms/Go

↓ 1 callersFunctionCountChars
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 a
strings/charoccurrence.go:12
↓ 1 callersMethodCreateChild
(NodeValue, int)
project_euler/problem_18/problem18.go:45
↓ 1 callersFunctionDecrypt
(cipherText string, rails int)
cipher/railfence/railfence.go:50
↓ 1 callersFunctionDefaultNew
DefaultNew returns a new HashMap instance with default values
structure/hashmap/hashmap.go:24
↓ 1 callersMethodDelAtEnd
DelAtEnd deletes the snode at the tail(end) of the list and returns its value. Returns false if the list is empty.
structure/linkedlist/singlylinkedlist.go:65
↓ 1 callersMethodDelete
Delete the current item.
structure/linkedlist/cyclic.go:74
↓ 1 callersFunctionDiceThrow
DiceThrow returns the number of ways to get sum `sum` using `m` dice with `n` faces
dynamic/dicethrow.go:10
↓ 1 callersMethodDifference
Difference: gives new difference set of both sets. ex: [1,2,3] Difference [3,4,5] -> [1,2]
structure/set/set.go:47
↓ 1 callersMethodDijkstra
(start, end int)
graph/dijkstra.go:25
↓ 1 callersFunctionDistance
Distance Function that gives Levenshtein Distance
strings/levenshtein/levenshteindistance.go:10
↓ 1 callersFunctionDistance
(str1, str2 string)
strings/hamming/hammingdistance.go:18
↓ 1 callersFunctionDistance
Distance calculates the shortest distance between two points.
math/geometry/straightlines.go:18
↓ 1 callersFunctionDistance
Distance calculates the distance between to vectors with the Pythagoras theorem
math/pythagoras/pythagoras.go:15
↓ 1 callersFunctionEditDistanceDP
EditDistanceDP is an optimised implementation which builds on the ideas of the recursive implementation. We use dynamic programming to compute the DP
dynamic/editdistance.go:37
↓ 1 callersFunctionEdmondKarp
(graph WeightedGraph, source int, sink int)
graph/edmondkarp.go:43
↓ 1 callersFunctionEggDropping
EggDropping finds the minimum number of attempts needed to find the critical floor with `eggs` number of eggs and `floors` number of floors
dynamic/eggdropping.go:10
↓ 1 callersFunctionEncrypt
(text string, rails int)
cipher/railfence/railfence.go:13
↓ 1 callersFunctionFastInverseSqrt
FastInverseSqrt assumes that argument is always positive, and it does not deal with negative numbers. The "magic" number 0x5f3759df is hex for 1597463
math/binary/fast_inverse_sqrt.go:17
↓ 1 callersMethodFindAllCycles
this function can do HasCycle() job but it is slower
graph/cycle.go:50
↓ 1 callersFunctionFindKthMax
FindKthMax returns the kth large element given an integer slice with nil `error` if found and returns -1 with `error` `search.ErrNotFound` if not foun
math/kthnumber.go:11
↓ 1 callersFunctionFindKthMin
FindKthMin returns kth small element given an integer slice with nil `error` if found and returns -1 with `error` `search.ErrNotFound` if not found. N
math/kthnumber.go:19
↓ 1 callersFunctionFindPath
Returns a mapping of vertices as path, if there is any from source to sink Otherwise, returns nil
graph/edmondkarp.go:16
↓ 1 callersFunctionFloydWarshall
FloydWarshall Returns all pair's shortest path using Floyd Warshall algorithm
graph/floydwarshall.go:17
↓ 1 callersFunctionGenerateElementSet
(out chan []string, n int)
math/permutation/heaps.go:42
↓ 1 callersFunctionGenerateParenthesis
(n int)
strings/generateparentheses/generateparentheses.go:12
↓ 1 callersFunctionGeneticString
GeneticString generates PopulationItem based on the imputed target string, and a set of possible runes to build a string with. In order to optimise st
strings/genetic/genetic.go:71
↓ 1 callersMethodGet
Get a Node from the Binary-Search Tree
structure/tree/bstree.go:76
↓ 1 callersFunctionGetIdx
(target int, nodes []int)
graph/depthfirstsearch.go:9
↓ 1 callersMethodGetLCA
(int, int)
graph/lowestcommonancestor.go:24
↓ 1 callersMethodGetLCA
(u, v int)
graph/lowestcommonancestor.go:61
↓ 1 callersMethodHas
Has Determines the tree has the node of Key
structure/tree/avl.go:89
↓ 1 callersMethodHasSpace
()
project_euler/problem_18/problem18.go:42
↓ 1 callersFunctionHash
Hash computes the SHA-1 hash of the input message
hashing/sha1/sha1.go:43
↓ 1 callersFunctionHash
Hash computes the MD5 hash of the input message
hashing/md5/md5.go:63
↓ 1 callersMethodHeapify
()
sort/heapsort.go:28
↓ 1 callersFunctionHeaps
Heap's Algorithm for generating all permutations of n objects
math/permutation/heaps.go:13
↓ 1 callersFunctionHuffDecode
HuffDecode recursively decodes the binary code in, by traversing the Huffman compression tree pointed by root. current stores the current node of the
compression/huffmancoding.go:106
↓ 1 callersFunctionHuffEncode
HuffEncode encodes the string in by applying the mapping defined by codes.
compression/huffmancoding.go:95
↓ 1 callersFunctionHuffEncoding
HuffEncoding recursively traverses the Huffman tree pointed by node to obtain the map codes, that associates a rune with a slice of booleans. Each cod
compression/huffmancoding.go:78
↓ 1 callersFunctionHuffTree
HuffTree returns the root Node of the Huffman tree by compressing listfreq. The compression produces the most optimal code lengths, provided listfreq
compression/huffmancoding.go:35
↓ 1 callersMethodInit
(slice []Comparable)
sort/heapsort.go:17
↓ 1 callersMethodInsertNonFull
(tree *BTree[T], key T)
structure/tree/btree.go:149
↓ 1 callersMethodIntersection
Intersection: gives new intersection set of both sets. ex: [1,2,3] Intersection [3,4,5] -> [3]
structure/set/set.go:44
↓ 1 callersMethodIsAlmostEqualTo
IsAlmostEqualTo verifies if two WeightedGraphs can be considered almost equal
graph/floydwarshall_test.go:17
↓ 1 callersFunctionIsArmstrong
(number int)
math/armstrong/isarmstrong.go:16
↓ 1 callersFunctionIsAutomorphic
(n T)
math/isautomorphic.go:16
↓ 1 callersFunctionIsInterleave
IsInterleave checks if string `s1` and `s2` can be interleaved to form string `s3`
dynamic/interleavingstrings.go:10
↓ 1 callersFunctionIsIsogram
(text string, order IsogramOrder)
strings/isisogram.go:34
↓ 1 callersFunctionIsLeapYear
(year int)
project_euler/problem_19/problem19.go:55
↓ 1 callersFunctionIsMatch
IsMatch checks if the string `s` matches the wildcard pattern `p`
dynamic/wildcardmatching.go:10
↓ 1 callersFunctionIsPalindromeRecursive
(text string)
strings/palindrome/ispalindrome.go:39
↓ 1 callersFunctionIsPangram
(text string)
strings/pangram/ispangram.go:21
↓ 1 callersFunctionIsParallel
IsParallel checks if two lines are parallel or not.
math/geometry/straightlines.go:42
↓ 1 callersFunctionIsPerpendicular
IsPerpendicular checks if two lines are perpendicular or not.
math/geometry/straightlines.go:47
↓ 1 callersFunctionIsSubsequence
Returns true if s is subsequence of t, otherwise return false.
strings/issubsequence.go:10
↓ 1 callersMethodIsSubsetOf
(superSet Set[T])
structure/set/set.go:84
↓ 1 callersFunctionIsSubsetSum
(array []int, sum int)
dynamic/subsetsum.go:15
↓ 1 callersMethodIsSupersetOf
(subSet Set[T])
structure/set/set.go:104
↓ 1 callersFunctionIterative
Iterative Faster iterative version of GcdRecursive without holding up too much of the stack
math/gcd/gcditerative.go:7
↓ 1 callersFunctionJosephusProblem
https://en.wikipedia.org/wiki/Josephus_problem This is a struct-based solution for Josephus problem.
structure/linkedlist/cyclic.go:120
↓ 1 callersFunctionKahn
Kahn's algorithm computes a topological ordering of a directed acyclic graph (DAG). `n` is the number of vertices, `dependencies` is a list of directe
graph/kahn.go:15
↓ 1 callersFunctionKmp
Kmp Function kmp performing the Knuth-Morris-Pratt algorithm.
strings/kmp/kmp.go:4
↓ 1 callersMethodKosaraju
Kosaraju returns a list of Strongly Connected Components (SCCs).
graph/kosaraju.go:15
↓ 1 callersFunctionKruskalMST
(n int, edges []Edge)
graph/kruskal.go:23
↓ 1 callersMethodLen
()
graph/prim.go:14
↓ 1 callersFunctionLongestArithmeticSubsequence
LongestArithmeticSubsequence returns the length of the longest arithmetic subsequence
dynamic/longestarithmeticsubsequence.go:10
↓ 1 callersFunctionLongestPalindrome
(s string)
strings/manacher/longestpalindrome.go:37
↓ 1 callersFunctionLongestPalindromicSubstring
LongestPalindromicSubstring returns the longest palindromic substring in the input string
dynamic/longestpalindromicsubstring.go:10
↓ 1 callersFunctionMaxCoins
MaxCoins returns the maximum coins we can collect by bursting the balloons
dynamic/burstballoons.go:6
↓ 1 callersMethodMaxPathValueSearch
MaxPathValueSearch is a method that searches the maximum path value in a tree given a certain depth
project_euler/problem_18/tree.go:51
↓ 1 callersFunctionMaxSubArraySum
MaxSubArraySum returns the sum of the maximum subarray in the input array
dynamic/maxsubarraysum.go:12
↓ 1 callersFunctionMaxSubarraySum
MaxSubarraySum returns the maximum subarray sum
other/maxsubarraysum/maxsubarraysum.go:13
↓ 1 callersFunctionMean
(values []T)
math/mean.go:7
↓ 1 callersFunctionMedian
(values []T)
math/median.go:14
↓ 1 callersFunctionMerge
Merge Perform merge sort on a slice
sort/mergesort.go:47
↓ 1 callersFunctionMillerRabinDeterministic
MillerRabinDeterministic is a Deterministic version of the Miller-Rabin test, which returns correct results for all valid int64 numbers.
math/prime/millerrabintest.go:122
↓ 1 callersFunctionMillerRabinProbabilistic
MillerRabinProbabilistic is a probabilistic test for primality of an integer based of the algorithm devised by Miller and Rabin.
math/prime/millerrabintest.go:102
↓ 1 callersFunctionMillerRandomTest
MillerRandomTest This is the intermediate step that repeats within the miller rabin primality test for better probabilitic chances of receiving the co
math/prime/millerrabintest.go:78
↓ 1 callersFunctionMode
(numbers []T)
math/mode.go:21
↓ 1 callersFunctionMoserDeBruijnSequence
(number int)
math/moserdebruijnsequence/sequence.go:9
↓ 1 callersFunctionMultiply64BitInt
Multiply64BitInt Checking if the integer multiplication overflows
math/modular/exponentiation.go:53
↓ 1 callersFunctionNaive
Implementation of naive string search O(n*m) where n=len(txt) and m=len(pattern)
strings/search/naive.go:5
↓ 1 callersFunctionNew
New creates a new HashMap instance with the specified size and capacity
structure/hashmap/hashmap.go:32
↓ 1 callersMethodNewCapacity
NewCapacity function increase the Capacity
structure/dynamicarray/dynamicarray.go:96
↓ 1 callersFunctionNewFenwickTree
NewFenwickTree creates a new Fenwick tree, initializes bit with the values of the array. Note that the queries and updates should have one based index
structure/fenwicktree/fenwicktree.go:20
↓ 1 callersFunctionNewLFU
NewLFU init the LFU cache with capacity
cache/lfu.go:33
↓ 1 callersFunctionNewSegmentTree
NewSegmentTree returns a new instance of a SegmentTree. It takes an input array of integers representing Array, initializes and builds the SegmentTree
structure/segmenttree/segmenttree.go:117
↓ 1 callersFunctionNewSqrtDecomposition
Create a new SqrtDecomposition instance with the parameters as specified by SqrtDecomposition comment Assumptions: - len(elements) > 0
sqrt/sqrtdecomposition.go:34
↓ 1 callersFunctionNextPermutation
(nums []int)
math/permutation/next_permutation.go:10
↓ 1 callersFunctionNotExist
(target int, slice []int)
graph/depthfirstsearch.go:18
↓ 1 callersFunctionNthCatalanNumber
NthCatalan returns the n-th Catalan Number Complexity: O(n²)
dynamic/catalan.go:15
↓ 1 callersFunctionOptimalBST
OptimalBST returns the minimum cost of constructing a Binary Search Tree
dynamic/optimalbst.go:6
↓ 1 callersFunctionParenthesis
Parenthesis algorithm checks if every opened parenthesis is closed correctly. When parcounter is less than 0 when a closing parenthesis is detected wi
strings/parenthesis/parenthesis.go:8
↓ 1 callersFunctionPartitionProblem
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.
dynamic/partitionproblem.go:11
↓ 1 callersMethodPeek
Peak is return last value that insert into our stack
structure/stack/stacklinkedlistwithlist.go:28
↓ 1 callersFunctionPointDistance
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 c
math/geometry/straightlines.go:53
↓ 1 callersMethodPop
()
sort/heapsort.go:37
↓ 1 callersMethodPop
Pop removes the minimum element (according to Less) from the heap. The complexity is O(log n) where n = h.Len().
structure/heap/heap.go:48
↓ 1 callersMethodPop
()
graph/prim.go:22
↓ 1 callersMethodPrimMST
(start Vertex)
graph/prim.go:30
← previousnext →401–500 of 1,378, ranked by callers