## Yonaba's Algorithm Implementations

I have contributed 106 implementations!

Visit Github Profile
• #### 10 harshad number

lua

Puzzle: A Harshad Number, in a given number base, is an integer that is divisible by the sum of its digit when written in that base. Write a function that returns whether an integer is a Harshad Number or not (in base 10). Solution: Of the numbers ...

• #### 100 doors problem

lua

Puzzle: There are 100 doors in a long hallway. They are all closed. The first time you walk by each door, you open it. The second time around, you close every second door (since they are all opened). On the third pass you stop at every third door and ...

• #### 99 bottles problem

lua

# 99 Bottles of Beer # ## Puzzle: ## You must print the lyric of the song as follows: ``` 99 bottles of beer on the wall, 99 bottles of beer. Take one down and pass it around, 98 bottles of beer on the wall. 98 bottles of beer on the wall, 98 ...

• #### a star search

lua

In computer science, A* (pronounced as "A star"( listen)) is a computer algorithm that is widely used in pathfinding and graph traversal, the process of plotting an efficiently traversable path between multiple points, called nodes. Noted for its ...

• #### ackermann

lua

In computability theory, the Ackermann function, named after Wilhelm Ackermann, is one of the simplest and earliest-discovered examples of a total computable function that is not primitive recursive. All primitive recursive functions are total and ...

• #### alpha beta pruning

lua

Alphabeta pruning is a search algorithm that seeks to decrease the number of nodes that are evaluated by the minimax algorithm in its search tree. It is an adversarial search algorithm used commonly for machine playing of two-player games (Tic-tac-toe, ...

• #### average

lua

In colloquial language, an average is the sum of a list of numbers divided by the number of numbers in the list. In mathematics and statistics, this would be called the arithmetic mean. In statistics, mean, median, and mode are all known as measures of ...

lua

• #### best first search

lua

Best-first search is a search algorithm which explores a graph by expanding the most promising node chosen according to a specified rule.Judea Pearl described best-first search as estimating the promise of node n by a "heuristic evaluation function ...

• #### binary search

lua

In computer science, binary search, also known as half-interval search or logarithmic search, is a search algorithm that finds the position of a target value, whether alone or part of a record as a key, within a sorted array. It works by comparing the ...

lua

• #### bogosort

lua

In computer science, bogosort (also permutation sort, stupid sort, slowsort, shotgun sort or monkey sort) is a particularly ineffective sorting algorithm based on the generate and test paradigm. The algorithm successively generates permutations of its ...

• #### boyer moore horspool

lua

In computer science, the BoyerMooreHorspool algorithm or Horspool's algorithm is an algorithm for finding substrings in strings. It was published by Nigel Horspool in 1980.It is a simplification of the BoyerMoore string search algorithm which is ...

• #### bozosort

lua

In computer science, bogosort (also permutation sort, stupid sort, slowsort, shotgun sort or monkey sort) is a particularly ineffective sorting algorithm based on the generate and test paradigm. The algorithm successively generates permutations of its ...

• #### breadth first search

lua

Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at the tree root (or some arbitrary node of a graph, sometimes referred to as a 'search key') and explores the neighbor nodes first, before ...

lua

lua

• #### bresenham line

lua

Bresenham's line algorithm is an algorithm that determines the points of an n-dimensional raster that should be selected in order to form a close approximation to a straight line between two points. It is commonly used to draw lines on a computer ...

• #### bubble sort

lua

Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is ...

• #### burrows wheeler transform

lua

The BurrowsWheeler transform (BWT, also called block-sorting compression) rearranges a character string into runs of similar characters. This is useful for compression, since it tends to be easy to compress a string that has runs of repeated characters ...

• #### caesar cipher

lua

In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the ...

• #### catalan numbers

lua

In combinatorial mathematics, the Catalan numbers form a sequence of natural numbers that occur in various counting problems, often involving recursively-defined objects. They are named after the Belgian mathematician Eugne Charles Catalan ...

• #### chebyshev distance

lua

In mathematics, Chebyshev distance (or Tchebychev distance), maximum metric, or L metric is a metric defined on a vector space where the distance between two vectors is the greatest of their differences along any coordinate dimension. It is named after ...

• #### cocktail sort

lua

Cocktail shaker sort, also known as bidirectional bubble sort, cocktail sort, shaker sort (which can also refer to a variant of selection sort), ripple sort, shuffle sort, or shuttle sort, is a variation of bubble sort that is both a stable sorting ...

• #### comb sort

lua

Comb sort is a relatively simple sorting algorithm originally designed by Wodzimierz Dobosiewicz in 1980. Later it was rediscovered by Stephen Lacey and Richard Box in 1991. Comb sort improves on bubble sort.The basic idea is to eliminate turtles, or ...

• #### convex hull

lua

Algorithms that construct convex hulls of various objects have a broad range of applications in mathematics and computer science.In computational geometry, numerous algorithms are proposed for computing the convex hull of a finite set of points, with ...

• #### convex hull

lua

Algorithms that construct convex hulls of various objects have a broad range of applications in mathematics and computer science.In computational geometry, numerous algorithms are proposed for computing the convex hull of a finite set of points, with ...

• #### convex hull

lua

Algorithms that construct convex hulls of various objects have a broad range of applications in mathematics and computer science.In computational geometry, numerous algorithms are proposed for computing the convex hull of a finite set of points, with ...

• #### convex hull

lua

Algorithms that construct convex hulls of various objects have a broad range of applications in mathematics and computer science.In computational geometry, numerous algorithms are proposed for computing the convex hull of a finite set of points, with ...

• #### convex hull

lua

Algorithms that construct convex hulls of various objects have a broad range of applications in mathematics and computer science.In computational geometry, numerous algorithms are proposed for computing the convex hull of a finite set of points, with ...

• #### convex hull

lua

Algorithms that construct convex hulls of various objects have a broad range of applications in mathematics and computer science.In computational geometry, numerous algorithms are proposed for computing the convex hull of a finite set of points, with ...

• #### convex hull

lua

Algorithms that construct convex hulls of various objects have a broad range of applications in mathematics and computer science.In computational geometry, numerous algorithms are proposed for computing the convex hull of a finite set of points, with ...

• #### counting sort

lua

In computer science, counting sort is an algorithm for sorting a collection of objects according to keys that are small integers; that is, it is an integer sorting algorithm. It operates by counting the number of objects that have each distinct key ...

lua

• #### depth first search

lua

Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in the case of a graph) and explores as far as possible along each branch before ...

• #### depth limited search

lua

In computer science, iterative deepening search or more specifically iterative deepening depth-first search (IDS or IDDFS) is a state space/graph search strategy in which a depth-limited version of depth-first search is run repeatedly with increasing ...

• #### derivative

lua

The derivative of a function of a real variable measures the sensitivity to change of a quantity (a function value or dependent variable) which is determined by another quantity (the independent variable). Derivatives are a fundamental tool of ...

lua

• #### dijkstra's shortest path

lua

Dijkstra's algorithm is an algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, road networks. It was conceived by computer scientist Edsger W. Dijkstra in 1956 and published three years later.The ...

• #### egyptian fractions

lua

An Egyptian fraction is a finite sum of distinct unit fractions, such as. That is, each fraction in the expression has a numerator equal to 1 and a denominator that is a positive integer, and all the denominators differ from each other. The value of an ...

• #### euclidean algorithm

lua

In mathematics, the Euclidean algorithm[a], or Euclid's algorithm, is an efficient method for computing the greatest common divisor (GCD) of two numbers, the largest number that divides both of them without leaving a remainder. It is named after the ...

• #### euclidean distance

lua

In mathematics, the Euclidean distance or Euclidean metric is the "ordinary" (i.e. straight-line) distance between two points in Euclidean space. With this distance, Euclidean space becomes a metric space. The associated norm is called the Euclidean ...

• #### euclidean norm

lua

In linear algebra, functional analysis, and related areas of mathematics, a norm is a function that assigns a strictly positive length or size to each vector in a vector spacesave for the zero vector, which is assigned a length of zero. A seminorm, on ...

• #### factorial

lua

In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,The value of 0! is 1, according to the convention for an empty product.The factorial operation is ...

• #### fibonacci series

lua

In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence:or (often, in modern usage):By definition, the first two numbers in the Fibonacci sequence are either 1 and 1, or 0 and 1, depending on the ...

• #### fisher-yates

lua

The Fisherâ€“Yates shuffle (named after Ronald Fisher and Frank Yates), also known as the Knuth shuffle (after Donald Knuth), is an algorithm for generating a random permutation of a finite setâ€”in plain terms, for randomly shuffling the set. The modern ...

lua

• #### floyd warshall

lua

In computer science, the FloydWarshall algorithm is an algorithm for finding shortest paths in a weighted graph with positive or negative edge weights (but with no negative cycles). A single execution of the algorithm will find the lengths (summed ...

• #### gale shapely

lua

In mathematics, economics, and computer science, the stable marriage problem (also stable matching problem or SMP) is the problem of finding a stable matching between two equally sized sets of elements given an ordering of preferences for each element. ...

lua

• #### gnome sort

lua

Gnome sort (or Stupid sort) is a sorting algorithm originally proposed by Dr. Hamid Sarbazi-Azad (Professor of Computer Engineering at Sharif University of Technology) in 2000 and called "stupid sort" (not to be confused with bogosort), and then later ...

• #### golden ratio algorithms

lua

The golden section search is a technique for finding the extremum (minimum or maximum) of a strictly unimodal function by successively narrowing the range of values inside which the extremum is known to exist. The technique derives its name from the ...

• #### hamming weight

lua

The Hamming weight of a string is the number of symbols that are different from the zero-symbol of the alphabet used. It is thus equivalent to the Hamming distance from the all-zero string of the same length. For the most typical case, a string of ...

• #### happy number

lua

A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number either equals 1 (where it will stay), or it loops ...

• #### heap sort

lua

In computer science, heapsort is a comparison-based sorting algorithm. Heapsort can be thought of as an improved selection sort: like that algorithm, it divides its input into a sorted and an unsorted region, and it iteratively shrinks the unsorted ...

• #### insertion sort

lua

Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. However, insertion sort ...

• #### iterative deepening depth first search

lua

In computer science, iterative deepening search or more specifically iterative deepening depth-first search (IDS or IDDFS) is a state space/graph search strategy in which a depth-limited version of depth-first search is run repeatedly with increasing ...

• #### josephus problem

lua

In computer science and mathematics, the Josephus Problem (or Josephus permutation) is a theoretical problem related to a certain counting-out game.People are standing in a circle waiting to be executed. Counting begins at a specified point in the ...

• #### knapsack

lua

A backpack also called bookbag, kitbag, knapsack, rucksack, pack, or sackpack is, in its simplest form, a cloth sack carried on one's back and secured with two straps that go over the shoulders, but there can be variations. Lightweight types of ...

• #### knuth morris pratt

lua

In computer science, the KnuthMorrisPratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" W within a main "text string" S by employing the observation that when a mismatch occurs, the word itself embodies sufficient ...

• #### knuth morris pratt

lua

In computer science, the KnuthMorrisPratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" W within a main "text string" S by employing the observation that when a mismatch occurs, the word itself embodies sufficient ...

• #### knuth morris pratt

lua

In computer science, the KnuthMorrisPratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" W within a main "text string" S by employing the observation that when a mismatch occurs, the word itself embodies sufficient ...

• #### knuth morris pratt

lua

In computer science, the KnuthMorrisPratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" W within a main "text string" S by employing the observation that when a mismatch occurs, the word itself embodies sufficient ...

• #### knuth morris pratt

lua

In computer science, the KnuthMorrisPratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" W within a main "text string" S by employing the observation that when a mismatch occurs, the word itself embodies sufficient ...

• #### knuth morris pratt

lua

In computer science, the KnuthMorrisPratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" W within a main "text string" S by employing the observation that when a mismatch occurs, the word itself embodies sufficient ...

• #### knuth morris pratt

lua

In computer science, the KnuthMorrisPratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" W within a main "text string" S by employing the observation that when a mismatch occurs, the word itself embodies sufficient ...

• #### lempel ziv welch

lua

LempelZivWelch (LZW) is a universal lossless data compression algorithm created by Abraham Lempel, Jacob Ziv, and Terry Welch. It was published by Welch in 1984 as an improved implementation of the LZ78 algorithm published by Lempel and Ziv in 1978. ...

• #### levenshtein distance

lua

In information theory and computer science, the Levenshtein distance is a string metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two words is the minimum number of single-character edits (i.e. ...

• #### linear search

lua

In computer science, linear search or sequential search is a method for finding a particular value in a list that checks each element in sequence until the desired element is found or the list is exhausted. The list need not be ordered.Linear search is ...

• #### manhattan distance

lua

Taxicab geometry, considered by Hermann Minkowski in 19th-century Germany, is a form of geometry in which the usual distance function of metric or Euclidean geometry is replaced by a new metric in which the distance between two points is the sum of the ...

• #### maximum subarray

lua

In computer science, the maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array of numbers which has the largest sum. For example, for the sequence of values 2, 1, 3, 4, 1, 2, 1, 5, 4; the contiguous ...

• #### memoization

lua

In computing, memoization is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again. Memoization has also been used in ...

• #### merge sort

lua

O(n log n) typical,In computer science, merge sort (also commonly spelled mergesort) is an efficient, general-purpose, comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the implementation preserves the ...

• #### minimax

lua

A minimax approximation algorithm (or L approximation or uniform approximation) is a method to find an approximation of a mathematical function that minimizes maximum error.For example, given a function defined on the interval and a degree bound, a ...

• #### minkowski distance

lua

The Minkowski distance is a metric in a normed vector space which can be considered as a generalization of both the Euclidean distance and the Manhattan distance.The Minkowski distance of order p between two pointsis defined as:For, the Minkowski ...

• #### monty hall problem

lua

The Monty Hall problem is a brain teaser, in the form of a probability puzzle (Gruber, Krauss and others), loosely based on the American television game show Let's Make a Deal and named after its original host, Monty Hall. The problem was originally ...

• #### move to front transform

lua

The move-to-front (MTF) transform is an encoding of data (typically a stream of bytes) designed to improve the performance of entropy encoding techniques of compression. When efficiently implemented, it is fast enough that its benefits usually justify ...

• #### n queens problem

lua

The eight queens puzzle is the problem of placing eight chess queens on an 88 chessboard so that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, column, or diagonal. The eight queens puzzle is an ...

• #### negamax

lua

Negamax search is a variant form of minimax search that relies on the zero-sum property of a two-player game.This algorithm relies on the fact that max(a, b) = min(a, b) to simplify the implementation of the minimax algorithm. More precisely, the value ...

• #### newton raphson

lua

A division algorithm is an algorithm which, given two integers N and D, computes their quotient and/or remainder, the result of division. Some are applied by hand, while others are employed by digital circuit designs and software.Division algorithms ...

lua

• #### pi algorithms

lua

Approximations for the mathematical constant pi () in the history of mathematics reached an accuracy within 0.04% of the true value before the beginning of the Common Era (Archimedes). In Chinese mathematics, this was improved to approximations correct ...

• #### pollard rho algorithm

lua

Pollard's rho algorithm is a special-purpose integer factorization algorithm. It was invented by John Pollard in 1975. It is particularly effective for a composite number having a small prime factor.The algorithm is based on Floyd's cycle-finding ...

• #### quick sort

lua

Quicksort (sometimes called partition-exchange sort) is an efficient sorting algorithm, serving as a systematic method for placing the elements of an array in order. Developed by Tony Hoare in 1959, with his work published in 1961, it is still a ...

• #### rabin karp

lua

In computer science, the RabinKarp algorithm or KarpRabin algorithm is a string searching algorithm created by Richard M. Karp and Michael O. Rabin(1987) that uses hashing to find any one of a set of pattern strings in a text. For text of length n and ...

• #### radix sort

lua

In computer science, radix sort is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same significant position and value. A positional notation is required, but ...

lua

• #### roman numerals

lua

The numeric system represented by Roman numerals originated in ancient Rome and remained the usual way of writing numbers throughout Europe well into the late Middle Ages. Numbers in this system are represented by combinations of letters from the Latin ...

lua

lua

• #### run length encoding

lua

Run-length encoding (RLE) is a very simple form of lossless data compression in which runs of data (that is, sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as ...

• #### selection sort

lua

In computer science, selection sort is a sorting algorithm, specifically an in-place comparison sort. It has O(n2) time complexity, making it inefficient on large lists, and generally performs worse than the similar insertion sort. Selection sort is ...

• #### self descriptive number

lua

In mathematics, a self-descriptive number is an integer m that in a given base b is b digits long in which each digit d at position n (the most significant digit being at position 0 and the least significant at position b - 1) counts how many instances ...

• #### shell sort

lua

Shellsort, also known as Shell sort or Shell's method, is an in-place comparison sort. It can be seen as either a generalization of sorting by exchange (bubble sort) or sorting by insertion (insertion sort). The method starts by sorting pairs of ...

• #### sieve of eratosthenes

lua

In mathematics, the sieve of Eratosthenes (AncientGreek: , kskinon Eratosthnous), one of a number of prime number sieves, is a simple, ancient algorithm for finding all prime numbers up to any given limit. It does so by iteratively marking as ...

• #### stooge sort

lua

Stooge sort is a recursive sorting algorithm with a time complexity of O(nlog 3 / log 1.5 ) = O(n2.7095...). The running time of the algorithm is thus slower compared to efficient sorting algorithms, such as Merge sort, and is even slower than Bubble ...

• #### string to int

lua

Alvy (also known as Stringtown from the oil boom days c. 1890s - 1910 because the estimated population of 5000 residents and temporary workers were strung over the hills and hollows hence the nickname Stringtown) is an unincorporated community in Tyler ...

• #### successive over relaxation

lua

In numerical linear algebra, the method of successive over-relaxation (SOR) is a variant of the GaussSeidel method for solving a linear system of equations, resulting in faster convergence. A similar method can be used for any slowly converging ...

• #### sudoku

lua

A standard Sudoku puzzle contains 81 cells, in a 9 by 9 grid, and has 9 zones, each zone being the intersection of the first, middle, or last 3 rows, and the first, middle, or last 3 columns. Each cell may contain a number from one to nine; each number ...

• #### symmetric difference

lua

In mathematics, the symmetric difference of two sets is the set of elements which are in either of the sets and not in their intersection. The symmetric difference of the sets A and B is commonly denoted byororFor example, the symmetric difference of ...

lua

• #### tokenization

lua

Tokenization may refer to: https://en.wikipedia.org/wiki/Tokenization

• #### towers of hanoi

lua

The Tower of Hanoi (also called the Tower of Brahma or Lucas' Tower, and sometimes pluralized) is a mathematical game or puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with ...

• #### vigenere cipher

lua

The Vigenre cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.The Vigenre (French pronunciation:[vin]) cipher has been ...

• #### warshall

lua

In computer science, the FloydWarshall algorithm is an algorithm for finding shortest paths in a weighted graph with positive or negative edge weights (but with no negative cycles). A single execution of the algorithm will find the lengths (summed ...

lua