From a3beedefdfff450ff1461a19c4ee8855de040780 Mon Sep 17 00:00:00 2001 From: github-action <${GITHUB_ACTOR}@users.noreply.github.com> Date: Mon, 29 May 2023 19:51:21 +0000 Subject: [PATCH] Updated Documentation in README.md --- README.md | 229 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 155 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 8c7814432..776a50f4b 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,37 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. 1. [`Combinations`](./strings/combination/combination.go#L7): No description provided. +--- +
+ compression + +--- + +##### Functions: + +1. [`HuffDecode`](./compression/huffmancoding.go#L104): 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`](./compression/huffmancoding.go#L93): HuffEncode encodes the string in by applying the mapping defined by codes. +3. [`HuffEncoding`](./compression/huffmancoding.go#L76): 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`](./compression/huffmancoding.go#L33): 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. + +--- +##### Types + +1. [`Node`](./compression/huffmancoding.go#L17): No description provided. + +2. [`SymbolFreq`](./compression/huffmancoding.go#L25): No description provided. + + +--- +
+ compression_test + +--- + +##### Functions: + +1. [`SymbolCountOrd`](./compression/huffmancoding_test.go#L16): SymbolCountOrd computes sorted symbol-frequency list of input message + ---
conversion @@ -196,10 +227,10 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. 4. [`DecimalToBinary`](./conversion/decimaltobinary.go#L32): DecimalToBinary() function that will take Decimal number as int, and return it's Binary equivalent as string. 5. [`FuzzBase64Encode`](./conversion/base64_test.go#L113): No description provided. 6. [`HEXToRGB`](./conversion/rgbhex.go#L10): HEXToRGB splits an RGB input (e.g. a color in hex format; 0x) into the individual components: red, green and blue -7. [`IntToRoman`](./conversion/integertoroman.go#L17): IntToRoman converts an integer value to a roman numeral string. An error is returned if the integer is not between 1 and 3999. +7. [`IntToRoman`](./conversion/inttoroman.go#L17): 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`](./conversion/rgbhex.go#L41): 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`](./conversion/decimaltobinary.go#L22): Reverse() function that will take string, and returns the reverse of that string. -10. [`RomanToInteger`](./conversion/romantointeger.go#L40): 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. +10. [`RomanToInt`](./conversion/romantoint.go#L40): 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. ---
@@ -343,25 +374,28 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. --- -##### Package geometry contains geometric algorithms +##### Package geometry contains geometric algorithms Package geometry contains geometric algorithms --- ##### Functions: 1. [`Distance`](./math/geometry/straightlines.go#L18): Distance calculates the shortest distance between two points. -2. [`IsParallel`](./math/geometry/straightlines.go#L42): IsParallel checks if two lines are parallel or not. -3. [`IsPerpendicular`](./math/geometry/straightlines.go#L47): IsPerpendicular checks if two lines are perpendicular or not. -4. [`PointDistance`](./math/geometry/straightlines.go#L53): 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. -5. [`Section`](./math/geometry/straightlines.go#L24): 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. -6. [`Slope`](./math/geometry/straightlines.go#L32): Slope calculates the slope (gradient) of a line. -7. [`YIntercept`](./math/geometry/straightlines.go#L37): YIntercept calculates the Y-Intercept of a line from a specific Point. +2. [`EuclideanDistance`](./math/geometry/distance.go#L20): EuclideanDistance returns the Euclidean distance between points in any `n` dimensional Euclidean space. +3. [`IsParallel`](./math/geometry/straightlines.go#L42): IsParallel checks if two lines are parallel or not. +4. [`IsPerpendicular`](./math/geometry/straightlines.go#L47): IsPerpendicular checks if two lines are perpendicular or not. +5. [`PointDistance`](./math/geometry/straightlines.go#L53): 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`](./math/geometry/straightlines.go#L24): 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`](./math/geometry/straightlines.go#L32): Slope calculates the slope (gradient) of a line. +8. [`YIntercept`](./math/geometry/straightlines.go#L37): YIntercept calculates the Y-Intercept of a line from a specific Point. --- ##### Types -1. [`Line`](./math/geometry/straightlines.go#L13): No description provided. +1. [`EuclideanPoint`](./math/geometry/distance.go#L14): No description provided. -2. [`Point`](./math/geometry/straightlines.go#L9): No description provided. +2. [`Line`](./math/geometry/straightlines.go#L13): No description provided. + +3. [`Point`](./math/geometry/straightlines.go#L9): No description provided. --- @@ -411,6 +445,19 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. 9. [`WeightedGraph`](./graph/floydwarshall.go#L9): No description provided. +--- +
+ guid + +--- + +##### Package guid provides facilities for generating random globally unique identifiers. + +--- +##### Functions: + +1. [`New`](./strings/guid/guid.go#L28): New returns a randomly generated global unique identifier. + ---
hashmap @@ -428,6 +475,40 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. 1. [`HashMap`](./structure/hashmap/hashmap.go#L17): No description provided. +--- +
+ heap + +--- + +##### Functions: + +1. [`New`](./structure/heap/heap.go#L15): New gives a new heap object. +2. [`NewAny`](./structure/heap/heap.go#L24): NewAny gives a new heap object. element can be anything, but must provide less function. + +--- +##### Types + +1. [`Heap`](./structure/heap/heap.go#L9): No description provided. + + +--- +
+ heap_test + +--- + +##### Types + +1. [`testInt`](#L0): + + Methods: + 1. [`Less`](./structure/heap/heap_test.go#L11): No description provided. +2. [`testStudent`](#L0): + + Methods: + 1. [`Less`](./structure/heap/heap_test.go#L20): No description provided. + ---
kmp @@ -436,7 +517,13 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. ##### Functions: -1. [`Kmp`](./strings/kmp/kmp.go#L4): Kmp Function kmp performing the Knuth-Morris-Pratt algorithm. +1. [`Kmp`](./strings/kmp/kmp.go#L4): Kmp Function kmp performing the Knuth-Morris-Pratt algorithm. + +--- +##### Types + +1. [`args`](./strings/kmp/kmp_test.go#L39): No description provided. + ---
@@ -505,29 +592,32 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. --- -##### 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! author(s): [GooMonk](https://github.com/GooMonk) see krishnamurthy_test.go Package math is a package that contains mathematical algorithms and its different implementations. --- ##### Functions: 1. [`Abs`](./math/abs.go#L11): Abs returns absolute value -2. [`Combinations`](./math/binomialcoefficient.go#L20): C is Binomial Coefficient function This function returns C(n, k) for given n and k -3. [`Cos`](./math/cos.go#L10): Cos returns the cosine of the radian argument x. [See more](https://en.wikipedia.org/wiki/Sine_and_cosine) [Based on the idea of Bhaskara approximation of cos(x)](https://math.stackexchange.com/questions/3886552/bhaskara-approximation-of-cosx) -4. [`DefaultPolynomial`](./math/pollard.go#L16): DefaultPolynomial is the commonly used polynomial g(x) = (x^2 + 1) mod n -5. [`FindKthMax`](./math/kthnumber.go#L11): 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. -6. [`FindKthMin`](./math/kthnumber.go#L19): 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. -7. [`IsPerfectNumber`](./math/perfectnumber.go#L34): Checks if inNumber is a perfect number -8. [`IsPowOfTwoUseLog`](./math/checkisnumberpoweroftwo.go#L10): 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. -9. [`Lerp`](./math/lerp.go#L5): Lerp or Linear interpolation This function will return new value in 't' percentage between 'v0' and 'v1' -10. [`LiouvilleLambda`](./math/liouville.go#L24): Lambda is the liouville function This function returns λ(n) for given number -11. [`Mean`](./math/mean.go#L7): No description provided. -12. [`Median`](./math/median.go#L12): No description provided. -13. [`Mode`](./math/mode.go#L19): No description provided. -14. [`Mu`](./math/mobius.go#L21): Mu is the Mobius function This function returns μ(n) for given number -15. [`Phi`](./math/eulertotient.go#L5): Phi is the Euler totient function. This function computes the number of numbers less then n that are coprime with n. -16. [`PollardsRhoFactorization`](./math/pollard.go#L29): PollardsRhoFactorization is an implementation of Pollard's rho factorization algorithm using the default parameters x = y = 2 -17. [`Sin`](./math/sin.go#L9): Sin returns the sine of the radian argument x. [See more](https://en.wikipedia.org/wiki/Sine_and_cosine) -18. [`SumOfProperDivisors`](./math/perfectnumber.go#L17): Returns the sum of proper divisors of inNumber. +2. [`AliquotSum`](./math/aliquotsum.go#L14): This function returns s(n) for given number +3. [`Combinations`](./math/binomialcoefficient.go#L20): C is Binomial Coefficient function This function returns C(n, k) for given n and k +4. [`Cos`](./math/cos.go#L10): Cos returns the cosine of the radian argument x. [See more](https://en.wikipedia.org/wiki/Sine_and_cosine) [Based on the idea of Bhaskara approximation of cos(x)](https://math.stackexchange.com/questions/3886552/bhaskara-approximation-of-cosx) +5. [`DefaultPolynomial`](./math/pollard.go#L16): DefaultPolynomial is the commonly used polynomial g(x) = (x^2 + 1) mod n +6. [`FindKthMax`](./math/kthnumber.go#L11): 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`](./math/kthnumber.go#L19): 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. [`IsKrishnamurthyNumber`](./math/krishnamurthy.go#L12): IsKrishnamurthyNumber returns if the provided number n is a Krishnamurthy number or not. +9. [`IsPerfectNumber`](./math/perfectnumber.go#L34): Checks if inNumber is a perfect number +10. [`IsPowOfTwoUseLog`](./math/checkisnumberpoweroftwo.go#L10): 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. +11. [`Lerp`](./math/lerp.go#L5): Lerp or Linear interpolation This function will return new value in 't' percentage between 'v0' and 'v1' +12. [`LiouvilleLambda`](./math/liouville.go#L24): Lambda is the liouville function This function returns λ(n) for given number +13. [`Mean`](./math/mean.go#L7): No description provided. +14. [`Median`](./math/median.go#L12): No description provided. +15. [`Mode`](./math/mode.go#L19): No description provided. +16. [`Mu`](./math/mobius.go#L21): Mu is the Mobius function This function returns μ(n) for given number +17. [`Phi`](./math/eulertotient.go#L5): Phi is the Euler totient function. This function computes the number of numbers less then n that are coprime with n. +18. [`PollardsRhoFactorization`](./math/pollard.go#L29): PollardsRhoFactorization is an implementation of Pollard's rho factorization algorithm using the default parameters x = y = 2 +19. [`PronicNumber`](./math/pronicnumber.go#L15): PronicNumber returns true if argument passed to the function is pronic and false otherwise. +20. [`Sin`](./math/sin.go#L9): Sin returns the sine of the radian argument x. [See more](https://en.wikipedia.org/wiki/Sine_and_cosine) +21. [`SumOfProperDivisors`](./math/perfectnumber.go#L17): Returns the sum of proper divisors of inNumber. ---
@@ -690,7 +780,8 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. --- ##### Functions: -1. [`NewPolybius`](./cipher/polybius/polybius.go#L21): NewPolybius returns a pointer to object of Polybius. If the size of "chars" is longer than "size", "chars" are truncated to "size". +1. [`FuzzPolybius`](./cipher/polybius/polybius_test.go#L154): No description provided. +2. [`NewPolybius`](./cipher/polybius/polybius.go#L21): NewPolybius returns a pointer to object of Polybius. If the size of "chars" is longer than "size", "chars" are truncated to "size". --- ##### Types @@ -799,6 +890,7 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. 1. [`Decrypt`](./cipher/rsa/rsa.go#L43): Decrypt decrypts encrypted rune slice based on the RSA algorithm 2. [`Encrypt`](./cipher/rsa/rsa.go#L28): Encrypt encrypts based on the RSA algorithm - uses modular exponentitation in math directory +3. [`FuzzRsa`](./cipher/rsa/rsa_test.go#L79): No description provided. ---
@@ -862,26 +954,27 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. ##### Functions: 1. [`Bubble`](./sort/bubblesort.go#L9): Bubble is a simple generic definition of Bubble sort algorithm. -2. [`Bucket Sort`](./sort/bucketsort.go#L5): Bucket Sort works with the idea of distributing the elements of an array into a number of buckets. Each bucket is then sorted individually, either using a different sorting algorithm, or by recursively applying the bucket sorting algorithm. +2. [`Bucket`](./sort/bucketsort.go#L7): Bucket sorts a slice. It is mainly useful when input is uniformly distributed over a range. 3. [`Comb`](./sort/combSort.go#L17): Comb is a simple sorting algorithm which is an improvement of the bubble sorting algorithm. 4. [`Count`](./sort/countingsort.go#L11): No description provided. -5. [`Exchange`](./sort/exchangesort.go#L8): No description provided. -6. [`HeapSort`](./sort/heapsort.go#L116): No description provided. -7. [`ImprovedSimple`](./sort/simplesort.go#L27): 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 -8. [`Insertion`](./sort/insertionsort.go#L5): No description provided. -9. [`Merge`](./sort/mergesort.go#L41): Merge Perform merge sort on a slice -10. [`MergeIter`](./sort/mergesort.go#L55): No description provided. -11. [`Pancake Sort`](./sort/pancakesort.go#L7): Pancake Sort is a sorting algorithm that is similar to selection sort that reverses elements of an array. The Pancake Sort uses the flip operation to sort the array. -12. [`ParallelMerge`](./sort/mergesort.go#L66): ParallelMerge Perform merge sort on a slice using goroutines -13. [`Partition`](./sort/quicksort.go#L12): No description provided. -14. [`Patience`](./sort/patiencesort.go#L13): No description provided. -15. [`Pigeonhole`](./sort/pigeonholesort.go#L15): 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. -16. [`Quicksort`](./sort/quicksort.go#L39): Quicksort Sorts the entire array -17. [`QuicksortRange`](./sort/quicksort.go#L26): QuicksortRange Sorts the specified range within the array -18. [`RadixSort`](./sort/radixsort.go#L43): No description provided. -19. [`Selection`](./sort/selectionsort.go#L5): No description provided. -20. [`Shell`](./sort/shellsort.go#L5): No description provided. -21. [`Simple`](./sort/simplesort.go#L13): No description provided. +5. [`Cycle`](./sort/cyclesort.go#L10): 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. +6. [`Exchange`](./sort/exchangesort.go#L8): No description provided. +7. [`HeapSort`](./sort/heapsort.go#L116): No description provided. +8. [`ImprovedSimple`](./sort/simplesort.go#L27): 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 +9. [`Insertion`](./sort/insertionsort.go#L5): No description provided. +10. [`Merge`](./sort/mergesort.go#L41): Merge Perform merge sort on a slice +11. [`MergeIter`](./sort/mergesort.go#L55): No description provided. +12. [`Pancake`](./sort/pancakesort.go#L8): Pancake sorts a slice using flip operations, where flip refers to the idea of reversing the slice from index `0` to `i`. +13. [`ParallelMerge`](./sort/mergesort.go#L66): ParallelMerge Perform merge sort on a slice using goroutines +14. [`Partition`](./sort/quicksort.go#L12): No description provided. +15. [`Patience`](./sort/patiencesort.go#L13): No description provided. +16. [`Pigeonhole`](./sort/pigeonholesort.go#L15): 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. +17. [`Quicksort`](./sort/quicksort.go#L39): Quicksort Sorts the entire array +18. [`QuicksortRange`](./sort/quicksort.go#L26): QuicksortRange Sorts the specified range within the array +19. [`RadixSort`](./sort/radixsort.go#L43): No description provided. +20. [`Selection`](./sort/selectionsort.go#L5): No description provided. +21. [`Shell`](./sort/shellsort.go#L5): No description provided. +22. [`Simple`](./sort/simplesort.go#L13): No description provided. --- ##### Types @@ -916,6 +1009,7 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. ##### Functions: 1. [`CountChars`](./strings/charoccurrence.go#L12): 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`](./strings/isisogram.go#L34): No description provided. ---
@@ -925,16 +1019,9 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. ##### Functions: -1. [`Decrypt`](./cipher/transposition/transposition.go#L82): No description provided. -2. [`Encrypt`](./cipher/transposition/transposition.go#L54): No description provided. - ---- -##### Types - -1. [`KeyMissingError`](./cipher/transposition/transposition.go#L16): No description provided. - -2. [`NoTextToEncryptError`](./cipher/transposition/transposition.go#L15): No description provided. - +1. [`Decrypt`](./cipher/transposition/transposition.go#L81): No description provided. +2. [`Encrypt`](./cipher/transposition/transposition.go#L51): No description provided. +3. [`FuzzTransposition`](./cipher/transposition/transposition_test.go#L103): No description provided. ---
@@ -947,31 +1034,25 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. --- ##### Functions: -1. [`NewAVL`](./structure/tree/avl.go#L13): NewAVL create a novel AVL tree -2. [`NewBinarySearch`](./structure/tree/bstree.go#L18): NewBinarySearch create a novel Binary-Search tree -3. [`NewRB`](./structure/tree/rbtree.go#L23): Create a new Red-Black Tree +1. [`NewAVL`](./structure/tree/avl.go#L54): NewAVL creates a novel AVL tree +2. [`NewBinarySearch`](./structure/tree/bstree.go#L46): NewBinarySearch creates a novel Binary-Search tree +3. [`NewRB`](./structure/tree/rbtree.go#L57): NewRB creates a new Red-Black Tree --- ##### Types -1. [`AVL`](./structure/tree/avl.go#L8): No description provided. +1. [`AVL`](./structure/tree/avl.go#L48): No description provided. -2. [`BinarySearch`](./structure/tree/bstree.go#L13): No description provided. +2. [`AVLNode`](./structure/tree/avl.go#L18): No description provided. -3. [`Node`](./structure/tree/tree.go#L25): No description provided. +3. [`BSNode`](./structure/tree/bstree.go#L15): No description provided. -4. [`RB`](./structure/tree/rbtree.go#L18): No description provided. +4. [`BinarySearch`](./structure/tree/bstree.go#L40): No description provided. +5. [`RB`](./structure/tree/rbtree.go#L51): No description provided. ---- -
- tree_test - ---- - -##### Functions: +6. [`RBNode`](./structure/tree/rbtree.go#L25): No description provided. -1. [`FuzzRBTree`](./structure/tree/rbtree_test.go#L90): No description provided. ---