text
stringlengths
183
150k
path
stringlengths
15
112
bucket
stringclasses
4 values
source
stringclasses
14 values
group
stringclasses
121 values
spdx
stringclasses
11 values
repo_license
stringclasses
11 values
commit
stringclasses
13 values
lang
stringclasses
4 values
def_heavy
bool
1 class
comment_ratio
float64
0
1
restricted
bool
2 classes
fresh
bool
1 class
n_bytes
int64
183
150k
n_tokens
int64
-1
-1
--- tags: - Translated e_maxx_link: fixed_length_paths --- # Number of paths of fixed length / Shortest paths of fixed length The following article describes solutions to these two problems built on the same idea: reduce the problem to the construction of matrix and compute the solution with the usual matrix multip...
cp-algorithms/src/graph/fixed_length_paths.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.097
false
false
5,492
-1
--- tags: - Translated e_maxx_link: kirchhoff_theorem --- # Kirchhoff's theorem. Finding the number of spanning trees Problem: You are given a connected undirected graph (with possible multiple edges) represented using an adjacency matrix. Find the number of different spanning trees of this graph. The following fo...
cp-algorithms/src/graph/kirchhoff-theorem.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.222
false
false
2,646
-1
--- tags: - Translated e_maxx_link: diofant_2_equation --- # Linear Diophantine Equation A Linear Diophantine Equation (in two variables) is an equation of the general form: $$ax + by = c$$ where $a$, $b$, $c$ are given integers, and $x$, $y$ are unknown integers. In this article, we consider several classical p...
cp-algorithms/src/algebra/linear-diophantine-equation.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.136
false
false
9,180
-1
--- tags: - Translated e_maxx_link: discrete_log --- # Discrete Logarithm The discrete logarithm is an integer $x$ satisfying the equation $$a^x \equiv b \pmod m$$ for given integers $a$, $b$ and $m$. The discrete logarithm does not always exist, for instance there is no solution to $2^x \equiv 3 \pmod 7$. There...
cp-algorithms/src/algebra/discrete-log.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.131
false
false
8,445
-1
--- tags: - Original --- # Knuth's Optimization Knuth's optimization, also known as the Knuth-Yao Speedup, is a special case of dynamic programming on ranges, that can optimize the time complexity of solutions by a linear factor, from $O(n^3)$ for standard range DP to $O(n^2)$. ## Conditions The Speedup is applie...
cp-algorithms/src/dynamic_programming/knuth-optimization.md
algorithms
cp-algorithms
cp-algorithms/src/dynamic_programming
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.085
false
false
8,329
-1
--- tags: - Original --- # Strong Orientation A **strong orientation** of an undirected graph is an assignment of a direction to each edge that makes it a [strongly connected graph](strongly-connected-components.md). That is, after the *orientation* we should be able to visit any vertex from any vertex by following...
cp-algorithms/src/graph/strong-orientation.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.094
false
false
4,130
-1
--- tags: - Translated e_maxx_link: factorial_divisors --- # Finding Power of Factorial Divisor You are given two numbers $n$ and $k$. Find the largest integer $x$ such that $k^x$ divides $n!$. ## Prime $k$ {data-toc-label="Prime k"} Let's first consider the case of prime $k$. The explicit expression for factoria...
cp-algorithms/src/algebra/factorial-divisors.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.194
false
false
1,905
-1
--- tags: - Translated e_maxx_link: johnson_problem_2 --- # Scheduling jobs on two machines This task is about finding an optimal schedule for $n$ jobs on two machines. Every item must first be processed on the first machine, and afterwards on the second one. The $i$-th job takes $a_i$ time on the first machine, an...
cp-algorithms/src/schedules/schedule_two_machines.md
algorithms
cp-algorithms
cp-algorithms/src/schedules
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.06
false
false
4,856
-1
--- tags: - Translated e_maxx_link: bridge_searching_online --- # Finding Bridges Online We are given an undirected graph. A bridge is an edge whose removal makes the graph disconnected (or, more precisely, increases the number of connected components). Our task is to find all the bridges in the given graph. Infor...
cp-algorithms/src/graph/bridge-searching-online.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.07
false
false
14,703
-1
--- tags: - Translated e_maxx_link: reverse_element --- # Modular Multiplicative Inverse ## Definition A [modular multiplicative inverse](http://en.wikipedia.org/wiki/Modular_multiplicative_inverse) of an integer $a$ is an integer $x$ such that $a \cdot x$ is congruent to $1$ modular some modulus $m$. To write it ...
cp-algorithms/src/algebra/module-inverse.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.14
false
false
7,786
-1
--- tags: - Original --- # Binary search **Binary search** is a method that allows for quicker search of something by splitting the search interval into two. Its most common application is searching values in sorted arrays, however the splitting idea is crucial in many other typical tasks. ## Search in sorted arra...
cp-algorithms/src/num_methods/binary_search.md
algorithms
cp-algorithms
cp-algorithms/src/num_methods
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.125
false
false
19,122
-1
--- tags: - Translated e_maxx_link: fft_multiply --- # Fast Fourier transform In this article we will discuss an algorithm that allows us to multiply two polynomials of length $n$ in $O(n \log n)$ time, which is better than the trivial multiplication which takes $O(n^2)$ time. Obviously also multiplying two long nu...
cp-algorithms/src/algebra/fft.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.037
false
false
32,197
-1
--- tags: - Translated e_maxx_link: euclid_algorithm --- # Euclidean algorithm for computing the greatest common divisor Given two non-negative integers $a$ and $b$, we have to find their **GCD** (greatest common divisor), i.e. the largest number which is a divisor of both $a$ and $b$. It's commonly denoted by $\gc...
cp-algorithms/src/algebra/euclid-algorithm.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.101
false
false
6,164
-1
--- tags: - Translated e_maxx_link: dinic --- # Maximum flow - Dinic's algorithm Dinic's algorithm solves the maximum flow problem in $O(V^2E)$. The maximum flow problem is defined in this article [Maximum flow - Ford-Fulkerson and Edmonds-Karp](edmonds_karp.md). This algorithm was discovered by Yefim Dinitz in 197...
cp-algorithms/src/graph/dinic.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.153
false
false
8,059
-1
--- title: Generating all K-combinations tags: - Translated e_maxx_link: generating_combinations --- # Generating all $K$-combinations In this article we will discuss the problem of generating all $K$-combinations. Given the natural numbers $N$ and $K$, and considering a set of numbers from $1$ to $N$. The task is t...
cp-algorithms/src/combinatorics/generating_combinations.md
algorithms
cp-algorithms
cp-algorithms/src/combinatorics
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.045
false
false
5,754
-1
--- tags: - Translated e_maxx_link: segment_to_line --- # Finding the equation of a line for a segment The task is: given the coordinates of the ends of a segment, construct a line passing through it. We assume that the segment is non-degenerate, i.e. has a length greater than zero (otherwise, of course, infinitel...
cp-algorithms/src/geometry/segment-to-line.md
algorithms
cp-algorithms
cp-algorithms/src/geometry
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.171
false
false
4,502
-1
/* * BinarySearchTree.cpp * * Created on: 2011-11-28 * Author: morin */ #include "BinarySearchTree.h" #include "utils.h" namespace ods { /** * Todo: Do this for other classes and/or move this up into BinarySearchTree<Node,T> */ template<> BinarySearchTree1<int>::BinarySearchTree1() : BinarySearchTree<BST...
ods-code/cpp/BinarySearchTree.cpp
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
cpp
false
0.387
false
false
961
-1
/******************************************************************************* * File : arraystack.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <stdlib.h> #include <assert.h> #include <string.h> #include <ar...
ods-code/c/src/arraystack.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.078
false
false
6,844
-1
/* * BinaryTree.h * * Created on: 2011-11-28 * Author: morin */ #ifndef BINARYTREE_H_ #define BINARYTREE_H_ #include <cstdlib> #include "ArrayDeque.h" namespace ods { template<class N> class BTNode { public: N *left; N *right; N *parent; BTNode() { left = right = parent = NULL; } }; template<cla...
ods-code/cpp/BinaryTree.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.066
false
false
3,490
-1
/******************************************************************************* * File : dllist.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <assert.h> #include <stdlib.h> #include <string.h> #include <iterat...
ods-code/c/src/dllist.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.072
false
false
4,074
-1
/* * SkiplistSSet.h * * Created on: 2011-11-28 * Author: morin */ #ifndef SKIPLISTSSET_H_ #define SKIPLISTSSET_H_ #include <cstdlib> #include <cstring> #include "utils.h" namespace ods { template<class T> class SkiplistSSet { protected: T null; struct Node { T x; int height; // length of next ...
ods-code/cpp/SkiplistSSet.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.077
false
false
3,211
-1
/* * RootishArrayStack.cpp * * Created on: 2011-11-23 * Author: morin */ #include "RootishArrayStack.h" namespace ods { template RootishArrayStack<int>::RootishArrayStack(); template RootishArrayStack<int>::~RootishArrayStack(); template void RootishArrayStack<int>::add(int,int); template int RootishArray...
ods-code/cpp/RootishArrayStack.cpp
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
cpp
false
0.467
false
false
462
-1
#include "utils.h" #include "array.h" namespace ods { class GeomVector { protected: array<int> x; public: unsigned hashCode() { long p = (1L<<32)-5; // prime: 2^32 - 5 long z = 0x64b6055aL; // 32 bits from random.org int z2 = 0x5067d19d; // random odd 32 bit number long s = 0; long zi = 1; for (...
ods-code/cpp/GeomVector.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.125
false
false
552
-1
/* * YFastTrie.h * * Created on: 2012-01-27 * Author: morin */ #ifndef YFASTTRIE_H_ #define YFASTTRIE_H_ #include "Treap.h" #include "XFastTrie.h" namespace ods { /** * Warning YFastTrie depends on XFastTrie, so you can't use it to store * the values UINT_MAX-1 or UINT_MAX-2 */ template<class T> clas...
ods-code/cpp/YFastTrie.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.183
false
false
1,925
-1
/******************************************************************************* * File : dllist.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_DLLIST_H_ #define ODS_DLLIST_H_ #include <stdlib.h> #include <i...
ods-code/c/include/dllist.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.758
false
false
3,929
-1
/* * RootishArrayStack.h * * Created on: 2011-11-23 * Author: morin */ #ifndef ROOTISHARRAYSTACK_H_ #define ROOTISHARRAYSTACK_H_ #include <math.h> #include "ArrayStack.h" namespace ods { template<class T> class RootishArrayStack { protected: ArrayStack<T*> blocks; int n; int i2b(int i); void grow(); ...
ods-code/cpp/RootishArrayStack.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.111
false
false
2,101
-1
/* * AdjacencyLists.h * * Created on: 2012-01-13 * Author: morin */ #ifndef ADJACENCYLISTS_H_ #define ADJACENCYLISTS_H_ #include "ArrayStack.h" namespace ods { class AdjacencyLists { protected: class List : public ArrayStack<int> { public: List() : ArrayStack<int>() {}; virtual ~List() {}; bool c...
ods-code/cpp/AdjacencyLists.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.175
false
false
1,132
-1
/* * main.cpp * * Created on: 2011-11-23 * Author: morin */ #include <cmath> #include <cassert> #include <ctime> #include <cstdlib> #include <iostream> using namespace std; #include "ArrayStack.h" #include "FastArrayStack.h" #include "ArrayDeque.h" #include "DualArrayDeque.h" #include "RootishArrayStack.h"...
ods-code/cpp/main.cpp
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
cpp
false
0.097
false
false
13,160
-1
/* * AdjacencyMatrix.cpp * * Created on: 2012-01-13 * Author: morin */ #include "AdjacencyMatrix.h" namespace ods { AdjacencyMatrix::AdjacencyMatrix(int n0) { n = n0; a = new bool*[n]; for (int i = 0; i < n; i++) a[i] = new bool[n]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) a[i][j...
ods-code/cpp/AdjacencyMatrix.cpp
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
cpp
false
0.304
false
false
456
-1
/* * ChainedHashTable.h * * Created on: 2011-11-30 * Author: morin */ #ifndef CHAINEDHASHTABLE_H_ #define CHAINEDHASHTABLE_H_ #include <climits> #include "utils.h" #include "array.h" #include "ArrayStack.h" namespace ods { template<class T> class ChainedHashTable { protected: typedef ArrayStack<T> List; ...
ods-code/cpp/ChainedHashTable.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.157
false
false
1,923
-1
/* * SEList.h * * Created on: 2011-11-25 * Author: morin */ #ifndef SELIST_H_ #define SELIST_H_ #include "ArrayDeque.h" #include "array.h" namespace ods { template<class T> class SEList { protected: int n; int b; class BDeque : public ArrayDeque<T> { using ArrayDeque<T>::a; using ArrayDeque<T>::j;...
ods-code/cpp/SEList.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.103
false
false
3,995
-1
/* * FastArrayStack.h * * Created on: 2011-11-23 * Author: morin */ #ifndef FASTARRAYSTACK_H_ #define FASTARRAYSTACK_H_ #include "ArrayStack.h" namespace ods { template<class T> class FastArrayStack : public ArrayStack<T> { protected: using ArrayStack<T>::a; using ArrayStack<T>::n; virtual void resize...
ods-code/cpp/FastArrayStack.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.192
false
false
1,056
-1
/* * BinarySearchTree.h * * Created on: 2011-11-28 * Author: morin */ #ifndef BINARYSEARCHTREE_H_ #define BINARYSEARCHTREE_H_ #include <climits> #include <cmath> #include "BinaryTree.h" #include "utils.h" namespace ods { template<class Node, class T> class BSTNode : public BTNode<Node> { public: T x; }; ...
ods-code/cpp/BinarySearchTree.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.089
false
false
5,398
-1
/******************************************************************************* * File : binarysearchtree.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <stdlib.h> #include <string.h> #include <assert.h> #inclu...
ods-code/c/src/binarysearchtree.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.087
false
false
4,495
-1
/******************************************************************************* * File : skiplistsset.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <string.h> #include <stdlib.h> #include <assert.h> #include <...
ods-code/c/src/skiplistsset.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.071
false
false
5,232
-1
/******************************************************************************* * File : binarysearchtree.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_BINARYSEARCHTREE_H_ #define ODS_BINARYSEARCHTREE_H_ #i...
ods-code/c/include/binarysearchtree.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.763
false
false
3,240
-1
/******************************************************************************* * File : iterator.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_ITERATOR_H_ #define ODS_ITERATOR_H_ typedef struct iterator_t ...
ods-code/c/include/iterator.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.838
false
false
1,186
-1
/******************************************************************************* * File : chainedhashtable.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_CHAINEDHASHTABLE_H_ #define ODS_CHAINEDHASHTABLE_H_ #i...
ods-code/c/include/chainedhashtable.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.792
false
false
3,478
-1
/* * FastSqrt.h * * Created on: 2011-11-25 * Author: morin */ #ifndef FASTSQRT_H_ #define FASTSQRT_H_ namespace ods { static int *sqrtab; static int *logtab; class FastSqrt { protected: static const int halfint = 1<<16; static const int r = 29; /** * Initialize the logarithm and square root tables ...
ods-code/cpp/FastSqrt.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.232
false
false
1,682
-1
/******************************************************************************* * File : arraystack.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_ARRAYSTACK_H_ #define ODS_ARRAYSTACK_H_ #include <stdlib.h> ...
ods-code/c/include/arraystack.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.801
false
false
7,900
-1
/* * ScapegoatTree.h * * Created on: 2011-11-30 * Author: morin */ #ifndef SCAPEGOATTREE_H_ #define SCAPEGOATTREE_H_ #include <cmath> #include "BinarySearchTree.h" namespace ods { template<class Node, class T> class ScapegoatTree : public BinarySearchTree<Node, T> { protected: using BinaryTree<Node>::n...
ods-code/cpp/ScapegoatTree.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.096
false
false
3,627
-1
/* * DualArrayDeque.cpp * * Created on: 2011-11-23 * Author: morin */ #include "DualArrayDeque.h" #include "utils.h" namespace ods { template DualArrayDeque<int>::DualArrayDeque(); template DualArrayDeque<int>::~DualArrayDeque(); template int DualArrayDeque<int>::get(int); template int DualArrayDeque<int...
ods-code/cpp/DualArrayDeque.cpp
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
cpp
false
0.471
false
false
500
-1
/******************************************************************************* * File : chainedhashtable.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <string.h> #include <assert.h> #include <limits.h> #includ...
ods-code/c/src/chainedhashtable.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.174
false
false
5,108
-1
/* * DLList.h * * Created on: 2011-11-24 * Author: morin */ #ifndef DLLIST_H_ #define DLLIST_H_ namespace ods { template<class T> class DLList { protected: struct Node { T x; Node *prev, *next; }; Node dummy; int n; void remove(Node *w); Node* addBefore(Node *w, T x); Node* getNode(int i); publ...
ods-code/cpp/DLList.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.083
false
false
1,846
-1
/******************************************************************************* * File : dualarraydeque.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_DUALARRAYDEQUE_H_ #define ODS_DUALARRAYDEQUE_H_ #include...
ods-code/c/include/dualarraydeque.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.781
false
false
4,633
-1
/******************************************************************************* * File : skiplistsset.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_SKIPLISTSSET_H_ #define ODS_SKIPLISTSSET_H_ #include <stdl...
ods-code/c/include/skiplistsset.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.778
false
false
3,875
-1
/* * BinaryHeap.h * * Created on: 2011-11-30 * Author: morin */ #ifndef BINARYHEAP_H_ #define BINARYHEAP_H_ #include <cstring> #include "utils.h" #include "array.h" namespace ods { template<class T> class BinaryHeap { protected: array<T> a; int n; void resize(); void bubbleUp(int i); void trickleDow...
ods-code/cpp/BinaryHeap.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.102
false
false
2,192
-1
/* * ArrayStack.h * * Created on: 2011-11-23 * Author: morin */ #ifndef ARRAYSTACK_H_ #define ARRAYSTACK_H_ #include "array.h" #include "utils.h" namespace ods { template<class T> class DualArrayDeque; template<class T> class ArrayStack { protected: friend class DualArrayDeque<T>; array<T> a; int n; ...
ods-code/cpp/ArrayStack.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.131
false
false
1,513
-1
/******************************************************************************* * File : skiplist.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_SKIPLIST_H_ #define ODS_SKIPLIST_H_ #include <stdlib.h> #incl...
ods-code/c/include/skiplist.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.74
false
false
3,961
-1
/* * XFastTrie.h * * Created on: 2012-01-26 * Author: morin * WARNING: This class can not store the unsigned integers UINT_MAX-1 or UINT_MAX-2 */ #ifndef XFASTTRIE_H_ #define XFASTTRIE_H_ #include <climits> #include "LinearHashTable.h" #include "BinaryTrie.h" namespace ods { template<class Node, class ...
ods-code/cpp/XFastTrie.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.115
false
false
4,780
-1
/******************************************************************************* * File : arraydeque.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_ARRAYDEQUE_H_ #define ODS_ARRAYDEQUE_H_ #include <stdlib.h> ...
ods-code/c/include/arraydeque.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.776
false
false
5,797
-1
/******************************************************************************* * File : skiplist.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <assert.h> #include <string.h> #include <stdlib.h> #include <skip...
ods-code/c/src/skiplist.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.072
false
false
5,613
-1
/******************************************************************************* * File : selist.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <assert.h> #include <stdlib.h> #include <iterator.h> #include <arra...
ods-code/c/src/selist.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.052
false
false
8,014
-1
/******************************************************************************* * File : arrayqueue.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <assert.h> #include <string.h> #include <stdlib.h> #include <it...
ods-code/c/src/arrayqueue.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.088
false
false
4,169
-1
/* * BlockStore.h * * Created on: 2013-07-03 * Author: morin */ #ifndef BLOCKSTORE_H_ #define BLOCKSTORE_H_ #include "ArrayStack.h" namespace ods { /** * This class fakes an external memory block storage system. It's just a list * of blocks. */ template<class T> class BlockStore { protected: ArraySta...
ods-code/cpp/BlockStore.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.275
false
false
979
-1
/* * ArrayStack.cpp * * Created on: 2011-11-23 * Author: morin */ #include "ArrayStack.h" #include "utils.h" namespace ods { template ArrayStack<int>::ArrayStack(); template ArrayStack<int>::~ArrayStack(); template void ArrayStack<int>::add(int,int); template int ArrayStack<int>::remove(int); template ...
ods-code/cpp/ArrayStack.cpp
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
cpp
false
0.545
false
false
572
-1
/* * Treap.h * * Created on: 2011-11-28 * Author: morin */ #ifndef TREAP_H_ #define TREAP_H_ #include <climits> #include "BinarySearchTree.h" namespace ods { template<class Node, class T> class Treap; template<class Node, class T> class TreapNode : public BSTNode<Node, T> { protected: friend class Tre...
ods-code/cpp/Treap.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.153
false
false
3,501
-1
/******************************************************************************* * File : arraydeque.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <stdlib.h> #include <string.h> #include <assert.h> #include <it...
ods-code/c/src/arraydeque.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.069
false
false
7,304
-1
/******************************************************************************* * File : rootisharraystack.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_ROOTISHARRAYSTACK_H_ #define ODS_ROOTISHARRAYSTACK_H_ ...
ods-code/c/include/rootisharraystack.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.796
false
false
5,001
-1
/* * SLList.h * * Created on: 2011-11-25 * Author: morin * FIXME: This code is completely untested (but was ported from tested Java code) */ #ifndef SLLIST_H_ #define SLLIST_H_ #include <stdlib.h> namespace ods { template<class T> class SLList { T null; protected: class Node { public: T x; N...
ods-code/cpp/SLList.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.125
false
false
1,286
-1
/******************************************************************************* * File : selist.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_SELIST_H_ #define ODS_SELIST_H_ #include <stdlib.h> #include <i...
ods-code/c/include/selist.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.75
false
false
4,183
-1
/* * BTree.h * TODO: This thing needs a lot of work. It doesn't do any cleanup at all right now * Created on: 2013-07-03 * Author: morin */ #ifndef BTREE_H_ #define BTREE_H_ #include "array.h" #include "BlockStore.h" namespace ods { template<class T> class BTree { public: T null; int b; // the maximum ...
ods-code/cpp/BTree.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.072
false
false
7,649
-1
/******************************************************************************* * File : dualarraydeque.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <assert.h> #include <stdlib.h> #include <iterator.h> #inclu...
ods-code/c/src/dualarraydeque.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.095
false
false
4,971
-1
#include "utils.h" namespace ods { class Point3D { protected: int x0, x1, x2; public: unsigned hashCode() { // random number from random.org long long z[] = {0x2058cc50L, 0xcb19137eL, 0x2cb6b6fdL}; long zz = 0xbea0107e5067d19dL; long h0 = ods::hashCode(x0); long h1 = ods::hashCode(x1); long h2 = ods...
ods-code/cpp/Point3D.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.118
false
false
421
-1
/* * RedBlackTree.h * * Created on: 2011-11-30 * Author: morin */ #ifndef REDBLACKTREE_H_ #define REDBLACKTREE_H_ #include "BinarySearchTree.h" namespace ods { template<class Node, class T> class RedBlackTree; template<class Node, class T> class RedBlackNode : public BSTNode<Node, T> { protected: friend c...
ods-code/cpp/RedBlackTree.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.047
false
false
5,583
-1
/* * ArrayDeque.h * * Created on: 2011-11-23 * Author: morin */ #ifndef ARRAYDEQUE_H_ #define ARRAYDEQUE_H_ #include "array.h" #include "utils.h" namespace ods { template<class T> class ArrayDeque { protected: array<T> a; int j; int n; void resize(); public: ArrayDeque(); virtual ~ArrayDeque(); int...
ods-code/cpp/ArrayDeque.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.115
false
false
1,993
-1
/* * AdjacencyMatrix.h * * Created on: 2012-01-13 * Author: morin */ #ifndef ADJACENCYMATRIX_H_ #define ADJACENCYMATRIX_H_ namespace ods { class AdjacencyMatrix { protected: int n; bool **a; public: AdjacencyMatrix(int n); virtual ~AdjacencyMatrix(); void addEdge(int i, int j) { a[i][j] = true; } ...
ods-code/cpp/AdjacencyMatrix.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.22
false
false
766
-1
/* * BinaryTrie.h * * Created on: 2012-01-26 * Author: morin */ #ifndef BINARYTRIE_H_ #define BINARYTRIE_H_ #include<cstdlib> namespace ods { template<class N, class T> class BinaryTrieNode { public: T x; N *jump; N *parent; union { struct { N *left; N *right; }; struct { N *prev; N...
ods-code/cpp/BinaryTrie.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.11
false
false
3,909
-1
/* * SkiplistList.h * * Created on: 2011-11-28 * Author: morin */ #ifndef SkiplistList_H_ #define SkiplistList_H_ #include <cstdlib> #include <cstring> #include "utils.h" namespace ods { template<class T> class SkiplistList { protected: T null; struct Node { T x; int height; // length of next ...
ods-code/cpp/SkiplistList.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.077
false
false
2,958
-1
/******************************************************************************* * File : rootisharraystack.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <stdlib.h> #include <string.h> #include <assert.h> #inclu...
ods-code/c/src/rootisharraystack.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.098
false
false
6,531
-1
/* * utils.h * * Created on: 2011-11-23 * Author: morin */ #ifndef UTILS_H_ #define UTILS_H_ namespace ods { template<class T> inline T min(T a, T b) { return ((a)<(b) ? (a) : (b)); } template<class T> inline T max(T a, T b) { return ((a)>(b) ? (a) : (b)); } template<class T> inline int compare(T &x, ...
ods-code/cpp/utils.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.25
false
false
834
-1
/* * LinearHashTable.h * * Created on: 2011-12-16 * Author: morin */ #ifndef LINEARHASHTABLE_H_ #define LINEARHASHTABLE_H_ #include <climits> #include <iostream> using namespace std; #include "array.h" namespace ods { extern unsigned int tab[4][256]; template<class T> class LinearHashTable { static cons...
ods-code/cpp/LinearHashTable.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.154
false
false
3,383
-1
/* * ArrayQueue.h * * Created on: 2011-11-23 * Author: morin */ #ifndef ARRAYQUEUE_H_ #define ARRAYQUEUE_H_ #include "array.h" #include "utils.h" namespace ods { template<class T> class ArrayQueue { protected: array<T> a; int j; int n; void resize(); public: ArrayQueue(); virtual ~ArrayQueue(); vir...
ods-code/cpp/ArrayQueue.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.177
false
false
1,031
-1
/* * SLList.cpp * * Created on: 2011-11-25 * Author: morin */ #include "SLList.h" namespace ods { template SLList<int>::SLList(); template SLList<int>::~SLList(); template int SLList<int>::push(int x); template bool SLList<int>::add(int x); template int SLList<int>::remove(); template int SLList<int>::pop...
ods-code/cpp/SLList.cpp
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
cpp
false
0.438
false
false
381
-1
/******************************************************************************* * File : sllist.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_SLLIST_H_ #define ODS_SLLIST_H_ #include <stdlib.h> #include <i...
ods-code/c/include/sllist.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.767
false
false
3,079
-1
/* * array.h * * Created on: 2011-11-24 * Author: morin */ #ifndef ARRAY_H_ #define ARRAY_H_ #include <iostream> #include <algorithm> #include <stdlib.h> #include <assert.h> namespace ods { /** * A simple array class that simulates Java's arrays implementation - kind of * TODO: Make a reference-counted...
ods-code/cpp/array.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.214
false
false
1,646
-1
/* * Algorithms.h * * Created on: 2011-11-30 * Author: morin */ #ifndef ALGORITHMS_H_ #define ALGORITHMS_H_ #include "SLList.h" #include "utils.h" #include "array.h" namespace ods { template<class Graph> void bfs(Graph &g, int r) { bool *seen = new bool[g.nVertices()]; SLList<int> q; q.add(r); seen...
ods-code/cpp/Algorithms.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.099
false
false
3,371
-1
/******************************************************************************* * File : sllist.c * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #include <string.h> #include <stdlib.h> #include <assert.h> #include <iterat...
ods-code/c/src/sllist.c
algorithms
ods-code
ods-code/c/src
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.11
false
false
3,347
-1
/* * MeldableHeap.h * * Created on: 2011-11-30 * Author: morin */ #ifndef MELDABLEHEAP_H_ #define MELDABLEHEAP_H_ #include "BinaryTree.h" namespace ods { template<class Node, class T> class MeldableHeap; template<class Node, class T> class MHeapNode : public BTNode<Node> { public: T x; }; template<c...
ods-code/cpp/MeldableHeap.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.115
false
false
2,267
-1
/* * DualArrayDeque.h * * Created on: 2011-11-23 * Author: morin */ #ifndef DUALARRAYDEQUE_H_ #define DUALARRAYDEQUE_H_ #include "ArrayStack.h" namespace ods { template<class T> class DualArrayDeque { protected: ArrayStack<T> front; ArrayStack<T> back; void balance(); public: DualArrayDeque(); virtua...
ods-code/cpp/DualArrayDeque.h
algorithms
ods-code
ods-code
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.1
false
false
2,051
-1
/******************************************************************************* * File : arrayqueue.h * Author(s) : Tekin Ozbek <tekin@tekinozbek.com> ******************************************************************************/ #ifndef ODS_ARRAYQUEUE_H_ #define ODS_ARRAYQUEUE_H_ #include <stdlib.h> ...
ods-code/c/include/arrayqueue.h
algorithms
ods-code
ods-code/c/include
CC-BY-2.5-CA
CC-BY-2.5-CA
9d22c44906dda2017b2ef0c762025bee644b58aa
c
false
0.809
false
false
3,578
-1
/** * @file * @brief Implementation of a [function](https://www.geeksforgeeks.org/variable-length-argument-c) similar to `printf` * @details * `printf` statement rewritten (as `min_printf`) in C without using the `stdio.h` library * Syntax of `min_printf` is same as `printf` * Currently min_printf handles: * I...
thealgorithms-c/developer_tools/min_printf.h
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.482
false
false
11,557
-1
#include <stdio.h> #include <stdlib.h> struct AVLnode { int key; struct AVLnode *left; struct AVLnode *right; int height; }; typedef struct AVLnode avlNode; int max(int a, int b) { return (a > b) ? a : b; } avlNode *newNode(int key) { avlNode *node = (avlNode *)malloc(sizeof(avlNode)); if (n...
thealgorithms-c/data_structures/binary_trees/avl_tree.c
algorithms
thealgorithms-c
thealgorithms-c/data_structures/binary_trees
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.063
false
false
9,160
-1
/** * @file * @author [TheShubham99](https://github.com/TheShubham99) * @author [Krishna Vedala](https://github.com/kvedala) * @brief Server side implementation of UDP client-server model * @see client_server/udp_client.c */ #ifdef _WIN32 // if compiling for Windows #define _WINSOCK_DEP...
thealgorithms-c/client_server/udp_server.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.461
false
false
2,446
-1
// Fibonacci Series using Dynamic Programming /* Author: Moinak Banerjee(moinak878) Date : 1 October ,2019 */ #include <stdio.h> #include <stdlib.h> int fib(int n) { // Out of Range checking if (n < 0) { printf("\nNo Such term !\n"); exit(0); } // declaring array to store fibon...
thealgorithms-c/math/fibonacci_dp.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.227
false
false
1,088
-1
/* Author : Saurav Dubey */ int countSubstrings(char *s) { int len = strlen(s); int i; int count = 0; for (i = 0; i < len; i++) { // cases handled for both odd and even lenghted Palindrome count += countPalin(s, i, i, len); if (i != len - 1) count += countPalin...
thealgorithms-c/leetcode/src/647.c
algorithms
thealgorithms-c
thealgorithms-c/leetcode/src
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.091
false
false
586
-1
int lengthOfLongestSubstring(char *str) { int n = strlen(str); if (!n) return 0; int L_len = 1; // length of longest substring int C_len = 1; // length of current substring int P_ind, i; // P_ind for previous index int visited[256]; // visited will keep track of visiting cha...
thealgorithms-c/leetcode/src/3.c
algorithms
thealgorithms-c
thealgorithms-c/leetcode/src
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.066
false
false
1,808
-1
/** * @file * @author [Edwin Ajong](https://github.com/eddybruv) * @brief [Odd Even Sort](https://en.wikipedia.org/wiki/Odd%E2%80%93even_sort) implementation * @details * This algorithm is divided into two phases- Odd and Even Phase. * The algorithm runs until the array elements are sorted and in each iteration t...
thealgorithms-c/sorting/odd_even_sort.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.527
false
false
3,935
-1
int distanceBetweenBusStops(int *distance, int distanceSize, int start, int destination) { int sum1 = 0, sum2 = 0; if (start > destination) { int tmp = start; start = destination; destination = tmp; } for (auto i = 0; i < distanceSize; ++i) { ...
thealgorithms-c/leetcode/src/1184.c
algorithms
thealgorithms-c
thealgorithms-c/leetcode/src
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0
false
false
487
-1
/** * @file * \brief Compute all possible approximate roots of any given polynomial using * [Durand Kerner * algorithm](https://en.wikipedia.org/wiki/Durand%E2%80%93Kerner_method) * * \author [Krishna Vedala](https://github.com/kvedala) * * Test the algorithm online: * https://gist.github.com/kvedala/27f1b0b65...
thealgorithms-c/numerical_methods/durand_kerner_roots.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.369
false
false
7,243
-1
#include <math.h> #include <stdio.h> #include <stdlib.h> int main() { int a[10], n, i, j, temp; float q1, q3, iqr; printf("Enter no. for Random Numbers :"); scanf("%d", &n); for (i = 0; i < n; i++) { a[i] = rand() % 100; } printf("Random Numbers Generated are :\n"); for (i ...
thealgorithms-c/misc/quartile.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.068
false
false
944
-1
/** * @file * @brief Implementation of [Floyd's Cycle * Detection](https://en.wikipedia.org/wiki/Cycle_detection) algorithm * @details * Given an array of integers containing `n + 1` integers, where each * integer is in the range [1, n] inclusive. If there is only one duplicate * number in the input array, this ...
thealgorithms-c/searching/floyd_cycle_detection_algorithm.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.492
false
false
2,328
-1
/** * \file * \brief [Problem 5](https://projecteuler.net/problem=5) solution - Naive * algorithm (slowest) * * \see Faster: problem_5/sol2.c * \see Fastest: problem_5/sol3.c */ #include <stdio.h> #include <stdlib.h> /** Pretty naive implementation. Just checks every number if it's devisable by 1 * through 20 ...
thealgorithms-c/project_euler/problem_5/sol1.c
algorithms
thealgorithms-c
thealgorithms-c/project_euler/problem_5
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.477
false
false
856
-1
/** * @file * @author [NVombat](https://github.com/NVombat) * @brief Server-side implementation of [TCP Half Duplex * Communication](http://www.tcpipguide.com/free/t_SimplexFullDuplexandHalfDuplexOperation.htm) * @see tcp_half_duplex_server.c * * @details * The algorithm is based on the simple TCP client and se...
thealgorithms-c/client_server/tcp_half_duplex_server.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.735
false
false
7,095
-1
/** * \file * \brief [Problem 13](https://projecteuler.net/problem=13) solution * \author [Krishna Vedala](https://github.com/kvedala) */ #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> /** Function to read the number from a file and store it in array. \n index 0 of output buffer...
thealgorithms-c/project_euler/problem_13/sol1.c
algorithms
thealgorithms-c
thealgorithms-c/project_euler/problem_13
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.178
false
false
4,130
-1
/** * @file * @author [Nairit11](https://github.com/Nairit11) * @author [Krishna Vedala](https://github.com/kvedala) * @brief Client side implementation of Server-Client system. * @see client_server/server.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef _WIN32 //...
thealgorithms-c/client_server/client.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.418
false
false
3,172
-1
#include <stdio.h> #include <stdlib.h> #include <time.h> #define ELEMENT_NR 20000 #define ARRAY_LEN(x) (sizeof(x) / sizeof((x)[0])) const char *notation = "Shell Sort Big O Notation:\ \n--> Best Case: O(n log(n)) \ \n--> Average Case: depends on gap sequence \ \n--> Worst Case: O(n)"; void show_...
thealgorithms-c/sorting/shell_sort.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.132
false
false
1,396
-1
#include <stdio.h> #include <stdlib.h> #define TRUE 1 #define FALSE 0 void cocktailSort(int arr[], int size) { int i, changed = TRUE, temp, start = 0, end = size - 1; while (changed) { changed = FALSE; for (i = start; i < end; i++) { if (arr[i] > arr[i + 1]) ...
thealgorithms-c/sorting/cocktail_sort.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.062
false
false
1,414
-1
/** * @file * @brief C implementation of [Hangman Game](https://en.wikipedia.org/wiki/Hangman_(game)) * @details * Simple, readable version of hangman. * Changed graphic to duck instead of traditional stick figure (same number of guesses). * @author [AtlantaEmrys2002](https://github.com/AtlantaEmrys2002) */ #inc...
thealgorithms-c/games/hangman.c
algorithms
thealgorithms-c
thealgorithms-c
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.241
false
false
8,044
-1
/** * Note: The returned array must be malloced, assume caller calls free(). */ // collecting sum Runtime: O(len(queries)), Space: O(1) int* sumEvenAfterQueries(int* nums, int numsSize, int** queries, int queriesSize, int* queriesColSize, int* returnSize){ int summ = 0; int* result = malloc(queriesSize * siz...
thealgorithms-c/leetcode/src/985.c
algorithms
thealgorithms-c
thealgorithms-c/leetcode/src
GPL-3.0
GPL-3.0
e5dad3fa8def3726ec850ca66a7f51521f8ad393
c
false
0.258
false
false
1,025
-1