diff --git a/Data Structures/Binary Indexed Tree.cpp b/Data Structures/Binary Indexed Tree.cpp deleted file mode 100644 index 3e0565d..0000000 --- a/Data Structures/Binary Indexed Tree.cpp +++ /dev/null @@ -1,41 +0,0 @@ -template class binaryIndexedTree{ - vector tree; - int mV; - public: - binaryIndexedTree(){mV=0;} - binaryIndexedTree(int size){ - tree=vector(size+1); - mV=size; - } - inline void resize(int size){ - tree.clr; - tree=vector(size+1); - mV=size; - } - inline void upd(int idx,T v=1){ - while(idx<=mV){ - tree[idx]+=v; - idx+=idx&-idx; - } - } - inline T get(int idx){ - T ret=0; - while(idx){ - ret+=tree[idx]; - idx-=idx&-idx; - } - return ret; - } - inline T getS(int idx){ - T ret=tree[idx]; - if(idx){ - int z=idx-(idx&-idx); - idx--; - while(idx!=z){ - ret-=tree[idx]; - idx-=idx&-idx; - } - } - return ret; - } -}; diff --git a/Data Structures/Fraction Class.cpp b/Data Structures/Fraction Class.cpp deleted file mode 100644 index e2cd2ee..0000000 --- a/Data Structures/Fraction Class.cpp +++ /dev/null @@ -1,38 +0,0 @@ -class Fraction { -public: - long long N,D; - Fraction(long long num=0, long long den=1) : N(num), D(den) { - long long tmp = __gcd(N,D); - if ((tmp < 0) != (den < 0)) - tmp = -tmp; - N /= tmp; - D /= tmp; - } - bool operator<(const Fraction& b) const { - return (N*b.D < b.N*D); - } - bool operator==(const Fraction& b) const { - return (N == b.N && D == b.D); - } - bool operator!=(const Fraction& b) const { - return (N != b.N || D != b.D); - } - Fraction operator+(const Fraction& b) const { - return Fraction(N*b.D + D*b.N, D*b.D); - } - Fraction operator-(const Fraction& b) const { - return Fraction(N*b.D - D*b.N, D*b.D); - } - Fraction operator*(const Fraction& b) const { - return Fraction(N*b.N, D*b.D); - } - Fraction operator/(const Fraction& b) const { - return Fraction(N*b.D, D*b.N); - } -}; -ostream& operator<<(ostream& out, Fraction& f) { - out << f.N; - if (f.D > 1) - out << "/" << f.D; - return out; -} diff --git a/Data Structures/Minimum Subsequent Value.cpp b/Data Structures/Minimum Subsequent Value.cpp deleted file mode 100644 index 035390b..0000000 --- a/Data Structures/Minimum Subsequent Value.cpp +++ /dev/null @@ -1,31 +0,0 @@ -struct MyQ{ - deque D, Min; - - void push(int val) { - //Pushes in element at the back of Queue - //Complexity - O(1), amortized - - D.push_back(val); - - while(!Min.empty() && Min.back() > val) Min.pop_back(); - - Min.push_back(val); - } - - void pop() { - //Pops an element from the front of Queue - //Complexity - O(1), amortized - - if(Min.front() == D.front()) - Min.pop_front(); - - D.pop_front(); - } - - int getMin() { - //Returns minimum of current existing elements of queue - //Complexity - O(1) - - return Min.front(); - } -}; diff --git a/Data Structures/Minimum Subsequent Value.cpp~ b/Data Structures/Minimum Subsequent Value.cpp~ deleted file mode 100644 index 035390b..0000000 --- a/Data Structures/Minimum Subsequent Value.cpp~ +++ /dev/null @@ -1,31 +0,0 @@ -struct MyQ{ - deque D, Min; - - void push(int val) { - //Pushes in element at the back of Queue - //Complexity - O(1), amortized - - D.push_back(val); - - while(!Min.empty() && Min.back() > val) Min.pop_back(); - - Min.push_back(val); - } - - void pop() { - //Pops an element from the front of Queue - //Complexity - O(1), amortized - - if(Min.front() == D.front()) - Min.pop_front(); - - D.pop_front(); - } - - int getMin() { - //Returns minimum of current existing elements of queue - //Complexity - O(1) - - return Min.front(); - } -}; diff --git a/Data Structures/Range Minimum Query ( Frenwick Tree ).cpp b/Data Structures/Range Minimum Query ( Frenwick Tree ).cpp deleted file mode 100644 index ea2de0e..0000000 --- a/Data Structures/Range Minimum Query ( Frenwick Tree ).cpp +++ /dev/null @@ -1,61 +0,0 @@ -/// Author : Bidhan Roy -/// Range Minimum Query using Frenweek Tree ( Binary indexed tree ) -/// Source : https://github.com/BidhanRoy/Algorithm-Code-Library -/// 1 based - -template < typename Int > -class rangeMinimumQuery { - - Int Inf; /// infinite value - Int *Tree; /// vector containing the actual tree - unsigned size; /// size of the tree - - public : - - rangeMinimumQuery ( unsigned _size ) : Inf ( numeric_limits< Int >::max() ) , size( _size ) { - /// size of tree should be double of original array - Tree = new Int [ ( size << 1 ) + 1 ]; - fill( Tree , Tree + (size<<1) + 1 , Inf ); - } - - ~rangeMinimumQuery () { - delete( Tree ); - size = Inf = 0; - } - - void set( unsigned idx, Int v ) { - - /// Sets value of index 'idx' to v, - /// if the existing value is already greater. - /// 1 Based - - if( idx == 0 ) { - cerr << "Indexes should be 1 based." << endl; - throw ; - } - - idx += size; - - while( idx ) { - Tree[ idx ] = min( Tree[ idx ] , v ); - idx >>= 1; - } - } - - Int get( unsigned L, unsigned R ) { - - /// L, R are 1 based - - Int ret = Inf; - L += size; R += size + 1; /// +1, to make it [L,R] from [L,R) - - while( L < R ) { - if( L & 1 ) ret = min( ret , Tree[ L++ ] ); - if( R & 1 ) ret = min( ret , Tree[ --R ] ); - L >>= 1, R >>= 1; - } - - return ret; - } - -}; \ No newline at end of file diff --git a/Data Structures/Splay Tree.cpp b/Data Structures/Splay Tree.cpp deleted file mode 100644 index 0701113..0000000 --- a/Data Structures/Splay Tree.cpp +++ /dev/null @@ -1,262 +0,0 @@ -template< typename T, typename Comp = std::less< T > > -class SplayTree { - - struct node { - T *element; - node *left, *right, *parent; - node( const T &k ) { - left = right = parent = NULL; - element = new T(k); - } - ~node () { - delete left; - delete right; - delete parent; - delete element; - } - } *root; - - unsigned p_size; - - public : - - SplayTree() { root = NULL; p_size = 0; } - ~SplayTree() { delete root; } - - node *find( T k ) { return find( &root , k ); } - node *find( node **s, T k ) { - if( *s == NULL ) return NULL; - - node *curr, *pred; - - curr = *s; - pred = NULL; - - while( curr ) { - if( k == *( curr -> element ) ) break; - pred = curr; - if( k <= *( curr -> element ) ) curr = curr -> left; - else curr = curr -> right; - } - if( curr ) { - splay( curr ); - return curr ; - } - splay( pred ); - return NULL; - } - - unsigned size() { return p_size; } - - node *insert( T k ) { return insert( &root , k ); } - node *insert( node **s, T k ) { - if( *s == NULL ) { - p_size++; - return *s = new node ( k ); - } - - node *curr = *s; - node *anterior = NULL; - int dir = 0; - while( curr ) { - if( k == *( curr -> element ) ) return curr; - anterior = curr; - if( k <= *( curr -> element ) ) { - dir = -1; - curr = curr -> left; - } - else { - dir = 1; - curr = curr -> right; - } - } - p_size++; - curr = new node( k ); - curr -> parent = anterior; - if( dir == -1 ) anterior -> left = curr ; - else anterior -> right = curr; - splay( curr ); - return curr; - } - - void erase( T k ) { erase( &root , k ); } - void erase( node **root, T k ) { - node *sL, *sR; - if( find( root , k ) ) { - sL = (*root) -> left; - if( sL ) sL -> parent = NULL; - sR = (*root) -> right; - if( sR ) sR -> parent = NULL; - *root = join( sL , sR ); - } - } - - node *join( node *sL , node *sR ) { - if( sL ) { - find( &sL , INT_MAX ); - sL -> right = sR; - if( sR ) sR -> parent = sL; - return sL; - } - else if ( sR ) return sR; - return NULL; - } - - pair< node ** , node ** > split( node *root , T div ) { - if( root ) { - find( &root , div ); - node **sL, **sR; - *sL = root; - *sR = root -> right; - (*sL) -> right = NULL; - return make_pair( sL, sR ); - } - node ** empty; - empty = NULL; - return make_pair( empty , empty ); - } - - void splay( node *crt ) { splay( &root , crt ); } - void splay( node **root , node *crt ) { - node *father = crt -> parent; - while( father ) { - if( father -> parent == NULL ) singleRotate( crt ); - else doubleRotate( crt ); - father = crt -> parent; - } - *root = crt; - } - - void zigLeft( node *x ) { - node *p, *b; - p = x -> parent; - b = x -> right; - x -> right = p; - x -> parent = NULL; - if( b ) b -> parent = p; - p -> left = b; - p -> parent = x; - } - - void zigRight( node *x ) { - node *p, *b; - p = x -> parent; - b = x -> left; - x -> left = p; - x -> parent = NULL; - if( b ) b -> parent = p; - p -> right = b; - p -> parent = x; - } - - void zigZigLeft( node *x ) { - node *p, *g, *ggp; - node *b, *c; - p = x -> parent; - g = p -> parent; - b = x -> right; - c = p -> right; - ggp = g -> parent; - x -> right = p; - p -> parent = x; - p -> right = g; - g -> parent = p; - if( b ) b -> parent = p; - p -> left = b; - if( c ) c -> parent = g; - g -> left = c; - x -> parent = ggp; - if( ggp ) { - if( ggp -> left == g ) ggp -> left = x; - else ggp -> right = x; - } - } - - void zigZigRight ( node *x ) { - node *p, *g, *ggp; - node *b, *c; - p = x -> parent; - g = p -> parent; - b = x -> left; - c = p -> left; - ggp = g -> parent; - x -> left = p; - p -> parent = x; - p -> left = g; - g -> parent = p; - if( b ) b -> parent = p; - p -> right = b; - if( c ) c -> parent = g; - g -> right = c; - x -> parent = ggp; - if( ggp ) { - if( ggp -> left == g ) - ggp -> left = x; - else ggp -> right = x; - } - } - - void zigZagLeft ( node *x ) { - node *p, *g, *ggp; - node *a, *b; - p = x -> parent; - g = p -> parent; - ggp = g -> parent; - a = x -> left; - b = x -> right; - x -> left = g; - g -> parent = x; - x -> right = p; - p -> parent = x; - if( a ) a -> parent = g; - g -> right = a; - if( b ) b -> parent = p; - p -> left = b; - x -> parent = ggp; - if( ggp ) { - if( ggp -> left == g ) - ggp -> left = x; - else ggp -> right = x; - } - } - - void zigZagRight( node *x ) { - node *p, *g, *ggp; - node *a, *b; - - p = x -> parent; - g = p -> parent; - ggp = g -> parent; - a = x -> left; - b = x -> right; - x -> right = g; - g -> parent = x; - x -> left = p; - p -> parent = x; - if( a ) a -> parent = p; - p -> right = a; - if( b ) b -> parent = g; - g -> left = b; - x -> parent = ggp; - if( ggp ) { - if( ggp -> left == g ) ggp -> left = x; - else ggp -> right = x; - } - } - - void singleRotate( node *x ) { - if( x -> parent -> left == x ) zigLeft(x); - else zigRight(x); - } - - void doubleRotate( node *x ) { - if( x -> parent -> left == x && x -> parent -> parent -> left == x -> parent ) - zigZigLeft(x); - else if( x -> parent -> left == x && x -> parent -> parent -> right == x -> parent ) - zigZagLeft(x); - else if( x -> parent -> right == x && x -> parent -> parent -> right == x -> parent ) - zigZigRight(x); - else if( x -> parent -> right == x && x -> parent -> parent -> left == x -> parent ) - zigZagRight(x); - } -}; diff --git a/Geometry/Intersections/intersections.cpp b/Geometry/Intersections/intersections.cpp deleted file mode 100644 index 7187aaa..0000000 --- a/Geometry/Intersections/intersections.cpp +++ /dev/null @@ -1,18 +0,0 @@ -pair intersectionLineLine( line L1 , line L2 ){ - __typeof(L1.a) det = L1.a * L2.b - L1.b * L2.a; - point ret(-1,-1); - if( !sgn ( det, 0 ) ) return mp(false,ret); - ret.x = ( L1.b * L2.c - L2.b * L1.c ) / det; - ret.y = ( L1.c * L2.a - L2.c * L1.a ) / det; - return mp(true,ret); -} - -pair intersectionLineSegment( line L , segment S ){ - line L2( S.A , S.B ); - point ret(-1,-1); - pair P=intersectionLineLine( L , L2 ); - if(!P.xx) return mp(false,ret); - if( !sgn( dist(P.yy,S.A) + dist(P.yy,S.B) , dist(S.A,S.B) ) ) return mp(true,P.yy); - return mp(false,ret); -} - diff --git a/Geometry/Others/atan2 Adapter.cpp b/Geometry/Others/atan2 Adapter.cpp deleted file mode 100644 index 5860bae..0000000 --- a/Geometry/Others/atan2 Adapter.cpp +++ /dev/null @@ -1,7 +0,0 @@ -double get(double y,double x){ - if(!(y<-eps)) return atan2(y,x); - x=-x; - double ret=-atan2(y,x); - ret+=pi; - return ret; -} diff --git a/Geometry/Polygon related codes/area of a 2D polygon.cpp b/Geometry/Polygon related codes/area of a 2D polygon.cpp deleted file mode 100644 index 778765d..0000000 --- a/Geometry/Polygon related codes/area of a 2D polygon.cpp +++ /dev/null @@ -1,6 +0,0 @@ -double polygonArea( vector &P ) { - double area = 0; - int n=P.size(); - for( int i = 0, j = n - 1; i < n; j = i++ ) area += P[j].x * P[i].y - P[j].y * P[i].x; - return fabs(area)/2; -} diff --git a/Geometry/Polygon related codes/convex hull ( 2D ).cpp b/Geometry/Polygon related codes/convex hull ( 2D ).cpp deleted file mode 100644 index 0ca1e1f..0000000 --- a/Geometry/Polygon related codes/convex hull ( 2D ).cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* Author : Bidhan Roy - * Complexity : O (Nlog(N)) - * Handles Collinear points and duplicate points - * Report at `mail2bidhan@gmail.com` if you find any buf - */ - - -point p0; -bool comp(point a,point b){ - i64 d=area(p0,a,b); - if(d<0) return false; - if(d) return true; - return sqDist(p0,a) &points,vector &ans){ - int pos=0; - rep(i,sz(points)) - if(points[pos].y>points[i].y || (points[pos].y==points[i].y && points[pos].x>points[i].x)) pos=i; - p0=points[pos]; - sort(all(points),comp); - int i=0; - while(p0==points[i]) { - i++; - if(i==sz(points)) return ; - } - int start=i; - ans.pb(points[i-1]); - while(!area(ans[0],points[start],points[i])) { - i++; - if(i==sz(points)) return ; - } - i--; - int sec=i; - ans.pb(points[i]); bool one=1; - while(!area(ans[0],ans[1],points[i])){ - i++; - if(i==sz(points)) { if(one) return ; else break; } - one=0; - } - if(i-1>sec) i--; - if(i==sz(points)) return ; - ans.pb(points[i]); - i++; - for(; i eps) - dfs(p, f); - else { - add.a = b; - add.b = a; - add.c = p; //Note here that the order to a right-handed - add.ok = true; - g[p][b] = g[a][p] = g[b][a] = num; - F[num++] = add; - } - } - } - void dfs(int p, int now) { - //Recursive search of all should be removed from - //the inner surface of the convex hull - F[now].ok = 0; - deal(p, F[now].b, F[now].a); - deal(p, F[now].c, F[now].b); - deal(p, F[now].a, F[now].c); - } - bool same(int s, int t) { - Point &a = P[F[s].a]; - Point &b = P[F[s].b]; - Point &c = P[F[s].c]; - return fabs(volume(a, b, c, P[F[t].a])) < eps - && fabs(volume(a, b, c, P[F[t].b])) < eps - && fabs(volume(a, b, c, P[F[t].c])) < eps; - } - //Construction of three-dimensional convex hull - void create() { - int i, j, tmp; - face add; - num = 0; - if (n < 4) return; - //********************************************** - //This section is to ensure that the first four non-coplanar points - bool flag = true; - for (i = 1; i < n; i++) { - if (vlen(P[0] - P[i]) > eps) { - swap(P[1], P[i]); - flag = false; - break; - } - } - if (flag) return; - flag = true; - //So that the first three points are not collinear - for (i = 2; i < n; i++) { - if (vlen((P[0] - P[1]) * (P[1] - P[i])) > eps) { - swap(P[2], P[i]); - flag = false; - break; - } - } - if (flag) return; - flag = true; - //Not four points of the front face - for (int i = 3; i < n; i++) { - if (fabs((P[0] - P[1]) * (P[1] - P[2]) ^ (P[0] - P[i])) > eps) { - swap(P[3], P[i]); - flag = false; - break; - } - } - if (flag) return; - //***************************************** - for (i = 0; i < 4; i++) { - add.a = (i + 1) % 4; - add.b = (i + 2) % 4; - add.c = (i + 3) % 4; - add.ok = true; - if (dblcmp(P[i], add) > 0) - swap(add.b, add.c); - g[add.a][add.b] = g[add.b][add.c] = g[add.c][add.a] = num; - F[num++] = add; - } - for (i = 4; i < n; i++) { - for (j = 0; j < num; j++) { - if (F[j].ok && dblcmp(P[i], F[j]) > eps) { - dfs(i, j); - break; - } - } - } - tmp = num; - for (i = num = 0; i < tmp; i++) - if (F[i].ok) - F[num++] = F[i]; - } - //Surface - double area() { - double res = 0; - if (n == 3) { - Point p = cross(P[0], P[1], P[2]); - res = vlen(p) / 2.0; - return res; - } - for (int i = 0; i < num; i++) - res += area(P[F[i].a], P[F[i].b], P[F[i].c]); - return res / 2.0; - } - double volume() { - double res = 0; - Point tmp(0, 0, 0); - for (int i = 0; i < num; i++) - res += volume(tmp, P[F[i].a], P[F[i].b], P[F[i].c]); - return fabs(res / 6.0); - } - //The number of surface triangles - int triangle() { return num; } - //The number of polygons surface - int polygon() { - int i, j, res, flag; - for (i = res = 0; i < num; i++) { - flag = 1; - for (j = 0; j < i; j++) - if (same(i, j)) { - flag = 0; - break; - } - res += flag; - } - return res; - } - //Three-dimensional convex hull focus - Point barycenter() { - Point ans(0, 0, 0), o(0, 0, 0); - double all = 0; - for (int i = 0; i < num; i++) { - double vol = volume(o, P[F[i].a], P[F[i].b], P[F[i].c]); - ans = ans + (o + P[F[i].a] + P[F[i].b] + P[F[i].c]) / 4.0 * vol; - all += vol; - } - ans = ans / all; - return ans; - } - //Point to the plane distance - double ptoface(Point p, int i) { - return fabs( volume(P[F[i].a], P[F[i].b], P[F[i].c], p) - / vlen((P[F[i].b] - P[F[i].a]) * (P[F[i].c] - P[F[i].a]))); - } - #undef MAXN -}; diff --git a/Geometry/Structures & classes used in my code/line.cpp b/Geometry/Structures & classes used in my code/line.cpp deleted file mode 100644 index ee99fa3..0000000 --- a/Geometry/Structures & classes used in my code/line.cpp +++ /dev/null @@ -1,39 +0,0 @@ -struct line{ - #define DT int /// Datatype - DT a,b,c; - - line(){a=b=c=0;} /// default constructor - line(point p,point q):a(p.y-q.y),b(q.x-p.x),c(p.x*q.y-q.x*p.y){} /// constructor - - bool operator < (line B); /// smaller than operator - - void normalize(); /// generalizes the line coefficients 'a','b','c' - line perpendicular(point p); - /// returns the perpendicular line - /// which goes through point 'p' -}; - -void line::normalize(){ - /// generalizes the line coefficients 'a','b','c' - __typeof(a) g=gcd(a,gcd(b,c)); - a/=g, b/=g, c/=g; - int sign=(a<0 || (!a && b<0))?-1:1; - a*=sign, b*=sign, c*=sign; -} - -line line::perpendicular(point p){ - /// returns the perpendicular line - /// which goes through point 'p' - line ret; - ret.a=b, ret.b=-a; - ret.c=-p.x*ret.a-p.y*ret.b; - return ret; -} - -bool line::operator < (line B) { - /// smaller than operator - if(!sgn(a,B.a)) { - return sgn(b,B.b)==0?sgn(c,B.c)<0:sgn(b,B.b)<0; - } - return sgn(a,B.a)<0; -} diff --git a/Geometry/Structures & classes used in my code/point .cpp b/Geometry/Structures & classes used in my code/point .cpp deleted file mode 100644 index 9d4a76d..0000000 --- a/Geometry/Structures & classes used in my code/point .cpp +++ /dev/null @@ -1,47 +0,0 @@ -struct point{ - #define DT int /// Datatype - DT x,y; - point():x(0),y(0){} /// default constructor - point(DT _x,DT _y):x(_x),y(_y){} /// constructor - - bool operator < (point b) ; /// smaller than operator - bool operator == (point b) ; /// equal to operator - point operator - (point b) ; /// returns a vector from `this` to `b` - DT operator * (point b) ; /// Dot product of `this` and `b` - DT operator ^ (point b) ; /// Cross product of `this` and `b` - point pointBetween(point q,double m1,double m2); - /// returns a point from the joining segment of 'this' and 'q' - /// the distance ratio of which from 'this' and 'q' is m1:m2 -}; - -bool point::operator < (point b) { - /// smaller than operator - if(!sgn(x,b.x)) return sgn(y,b.y)<0; - return sgn(x,b.x)<0; -} - -bool point::operator == (point b) { - /// equal to operator - return !sgn(x,b.x) && !sgn(y,b.y); -} - -point point::operator - (point b){ - /// returns a vector from `this` to `b` - return point(x-b.x,y-b.y); -} - -__typeof(point::x) point::operator * (point b){ - /// Dot product - return x*b.x+y*b.y; -} - -__typeof(point::x) point::operator ^ (point b){ - /// Cross product - return x*b.y-y*b.x; -} - -point point::pointBetween(point q,double m1,double m2){ - /// returns a point from the joining segment of 'this' and 'q' - /// the distance ratio of which from 'this' and 'q' is m1:m2 - return point( ( m1 * q.x + m2 * x ) / ( m1 + m2 ) , ( m1 * q.y + m2 * y ) / ( m1 + m2 ) ); -} diff --git a/Geometry/Structures & classes used in my code/point(3D).cpp b/Geometry/Structures & classes used in my code/point(3D).cpp deleted file mode 100644 index d5cfeea..0000000 --- a/Geometry/Structures & classes used in my code/point(3D).cpp +++ /dev/null @@ -1,34 +0,0 @@ -struct Point { - double x, y, z; - Point() {} - - Point(double xx, double yy, double zz) : x(xx), y(yy), z(zz) {} - - //The difference between the two vectors - Point operator -(const Point p1) { - return Point(x - p1.x, y - p1.y, z - p1.z); - } - - //The sum of two vectors - Point operator +(const Point p1) { - return Point(x + p1.x, y + p1.y, z + p1.z); - } - - //cross - Point operator *(const Point p) { - return Point(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x); - } - - Point operator *(double d) { - return Point(x * d, y * d, z * d); - } - - Point operator /(double d) { - return Point(x / d, y / d, z / d); - } - - //Dot - double operator ^(Point p) { - return (x * p.x + y * p.y + z * p.z); - } -}; diff --git a/Geometry/Structures & classes used in my code/segment.cpp b/Geometry/Structures & classes used in my code/segment.cpp deleted file mode 100644 index 99e2d0d..0000000 --- a/Geometry/Structures & classes used in my code/segment.cpp +++ /dev/null @@ -1,26 +0,0 @@ -struct segment{ - point A,B; - segment():A(point(0,0)),B(point(0,0)){} - segment(point _A,point _B):A(_A),B(_B){} - bool inside(point c); /// checks if a point is inside the enclosing rectangle - bool intersect(segment Q) ; /// checks if 'this' intersect with 'Q' -}; - -bool segment::inside(point c){ - /// checks if a point is inside the enclosing rectangle - return (min(A.x,B.x)<=c.x && c.x<=max(A.x,B.x) && min(A.y,B.y)<=c.y && c.y<=max(A.y,B.y)); -} - -bool segment::intersect(segment Q){ - /// checks if 'this' intersect with 'Q' - __typeof(A.x) d1=area(Q.A,Q.B,A); - __typeof(A.x) d2=area(Q.A,Q.B,B); - __typeof(A.x) d3=area(A,B,Q.A); - __typeof(A.x) d4=area(A,B,Q.B); - if( ((d1>0 && d2<0) || (d1<0 && d2>0)) && ((d3>0 && d4<0) || (d3<0 && d4>0)) ) return true; - if(!d1 && Q.inside(A)) return true; - if(!d2 && Q.inside(B)) return true; - if(!d3 && inside(Q.A)) return true; - if(!d4 && inside(Q.B)) return true; - return false; -} diff --git a/Geometry/geometry template extension.cpp b/Geometry/geometry template extension.cpp deleted file mode 100644 index dba566d..0000000 --- a/Geometry/geometry template extension.cpp +++ /dev/null @@ -1,4 +0,0 @@ -const double pi=M_PI; -#define area(a,b,c) ((b-a)^(c-a)) -#define sqDist(a,b) (sqr(a.x-b.x)+sqr(a.y-b.y)) -#define dist(a,b) sqrt(sqDist(a,b)) diff --git a/Graph Algorithms & Data Structures/Bipartite Matching ( Hopcroft Karp ).cpp b/Graph Algorithms & Data Structures/Bipartite Matching ( Hopcroft Karp ).cpp deleted file mode 100644 index 6857744..0000000 --- a/Graph Algorithms & Data Structures/Bipartite Matching ( Hopcroft Karp ).cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author : Bidhan Roy - * Required Headers : - * Complexity : O (|E|√|V|) - * 1 based indexing - * If you find any bug contact me : mail2bidhan@gmail.com - */ - -namespace hopcroftKarp{ - #define MAXN 100001 /// Maximum possible Number of nodes - #define MAXE 150001 /// Maximum possible Number of edges - #define INF (1<<29) - int ptr[MAXN],next[MAXE],zu[MAXE]; - int n,m,match[MAXN],D[MAXN],q[MAXN]; - void init(int _n){ /// initialization _n=number of nodes - n=_n; - m=0; - memset(ptr,~0,sizeof(int)*(n+1)); - } - void add_edge(int u,int v){ /// Adding edge between u and v - next[m]=ptr[u];ptr[u]=m;zu[m]=v;++m; - } - bool bfs(){ - int u,v; - register int i; - int qh=0, qt=0; - for(i=1; i<=n; i++){ - if(!match[i]){ - D[i]=0; - q[qt++]=i; - } - else D[i]=INF; - } - D[0]=INF; - while(qh g[MAXN]; - - void init(int _n,int _s,int _t){ - n=_n, s=_s, t=_t; - esize=0; - //for(int i=0; iwEPS){ - if(pot[zu[i]]>pot[u]+cost[i]+cEPS){ - pot[zu[i]]=pot[u]+cost[i]; cont=1; - } - } - } - - for(toc=0,tof=0;tof+wEPSnode; - priority_queue,greater > q; - for(u=0;uwEPS){ - cc=c+cost[i]+pot[u]-pot[v=zu[i]]; - if(d[v]>cc){q.push(mp(d[v]=cc,v));pree[v]=i;} - } - } - if(!vis[ink])return 0; - f=flo-tof; - for(v=ink;v!=src;v=zu[i^1]) {i=pree[v];f=min(f,capa[i]);} - for(v=ink;v!=src;v=zu[i^1]) {i=pree[v];capa[i]-=f;capa[i^1]+=f;} - tof+=f; - toc+=f*(d[ink]-pot[src]+pot[ink]); - for(u=0;u, - * Complexity : O(N) - * If you find any bug report me : mail2bidhan@gmail.com - */ - -#define mx 100000 ///Maximum possible number of nodes - -vector edge[mx]; -int _low[mx], _dtime[mx], _dfstime, _stack[mx], _size, _comp[mx], _comps; -bool _instack[mx]; - -void tarjan(int u){ - _low[u]=_dtime[u]=++_dfstime; - _stack[_size++]=u; - _instack[u]=true; - int i; - for(i=0; i< int(edge[u].size()); i++){ - int v=edge[u][i]; - if(_dtime[v]==-1) tarjan(v), _low[u]=min(_low[u],_low[v]); - else if(_instack[v]) _low[u]=min(_low[u],_dtime[v]); - } - - if(_dtime[u]==_low[u]){ - _comps++; - int v=-1; - do{ - v=_stack[--_size]; - _instack[v]=false; - _comp[v]=_comps; - }while(u!=v); - } -} - -void scc(int n){ - _comps=_dfstime=_size=0; - memset(_dtime,-1,(n+1)*sizeof(int)); - memset(_low,0,(n+1)*sizeof(int)); - memset(_stack,0,(n+1)*sizeof(int)); - memset(_comp,0,(n+1)*sizeof(int)); - memset(_instack,0,(n+1)*sizeof(int)); - int i; - for(i=0; i>=1){ - res*=res; - if(m>0) res%= m; - if(p&i) { - res*=b; - if(m>0) res%=m; - } - } - return res; -} diff --git a/Mathematics/Chinese Remainder Theorem.cpp b/Mathematics/Chinese Remainder Theorem.cpp deleted file mode 100644 index 004dea7..0000000 --- a/Mathematics/Chinese Remainder Theorem.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Author : Bidhan Roy - * Required Headers : - * If you find any bug report at : mail2bidhan@gmail.com - * Solves equations of the format x % mods[i] = r[i], ( 0<=i &r,const vector< long long > &mods){ - long long M=1; - for(int i=0; i m, s; - for(int i=0; i=M) ret-=M; - } - return ret; -} diff --git a/Mathematics/Matrix Exponentiation.cpp b/Mathematics/Matrix Exponentiation.cpp deleted file mode 100644 index 9c0e834..0000000 --- a/Mathematics/Matrix Exponentiation.cpp +++ /dev/null @@ -1,44 +0,0 @@ -namespace matrix{ - #define size 105 ///Maximum size of the matrix - #define wint int ///datatype to use (int,long long etc) - wint mat[size][size],tmp[size][size],res[size][size]; - wint MOD; - int n; - void init(int _n,wint _MOD){ ///initialization, _n=size of the square matrix , _MOD=mod value - n=_n; - MOD=_MOD; - memset(mat,0,sizeof (mat)); - memset(tmp,0,sizeof (tmp)); - memset(res,0,sizeof (res)); - } - void mul(wint r[][size],wint a[][size],wint b[][size]) { - int i,j,t; - for(i=0; i0) { - if(p&1) mul(r,r,a); - mul(a,a,a); p>>=1; - } - } - void pow(wint p){ - mPow(res,mat,p); - memcpy(mat,res,n*size*sizeof(tmp[0][0])); - } - void print(wint pp[][size]){ - int i,j; - for(i=0; i'9') && (c<'a' || c>'z') && (c<'A' || c>'Z') ) continue; - break; - } - - str[ Len++ ] = c; - - while(1) { - c = getchar_unlocked(); - if( (c>='0' && c<='9') || (c>='a' && c<='z') || (c>='A' && c<='Z') ) str[ Len++ ] = c; - else break; - } - - str[ Len ] = '\0'; - - return Len; - } - - long long getLongLong(){ - - long long res = 0; - char c; - bool negative = false; - - while(1) { - c = getchar_unlocked(); - if( (c<'0' || c>'9') && c!='-') continue; - break; - } - - if( c=='-' ) negative = true, c = getchar_unlocked(); - - res = c-'0'; - - while(1) { - c = getchar_unlocked(); - if( c>='0' && c<='9' ) res = 10ll*res+c-'0'; - else break; - } - - return negative?-res:res; - } - - int getInt(){ - - int res = 0; - char c; - bool negative = false; - - while(1) { - c = getchar_unlocked(); - if( (c<'0' || c>'9') && c!='-') continue; - break; - } - - if( c=='-' ) negative = true, c = getchar_unlocked(); - - res = c-'0'; - - while(1) { - c = getchar_unlocked(); - if( c>='0' && c<='9' ) res = 10*res+c-'0'; - else break; - } - - return negative?-res:res; - } - -}; diff --git a/Miscellaneous Codes/Roman - Decimal Converter ( Both way ).cpp b/Miscellaneous Codes/Roman - Decimal Converter ( Both way ).cpp deleted file mode 100644 index 657e72c..0000000 --- a/Miscellaneous Codes/Roman - Decimal Converter ( Both way ).cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Author : Bidhan Roy - * Required Headers : - * Range 0 to 4999 . 0 euals to empty string ("") - * Roman numerals are expressed in uppercase - * If you find any bug contact me : mail2bidhan@gmail.com - */ - -string decimalToRoman( int n ){ - if(n<4) return string(n,'I'); - if(n<6) return string(5-n,'I')+"V"; - if(n<9) return "V"+string(n-5,'I'); - if(n<11) return string(10-n,'I')+"X"; - if(n<40) return string(n/10,'X')+decimalToRoman(n%10); - if(n<60) return string(5-n/10,'X')+'L'+decimalToRoman(n%10); - if(n<90) return "L"+string(n/10-5,'X')+decimalToRoman(n%10); - if(n<110) return string(10-n/10,'X')+"C"+decimalToRoman(n%10); - if(n<400) return string(n/100,'C')+decimalToRoman(n%100); - if(n<600) return string(5-n/100,'C')+'D'+decimalToRoman(n%100); - if(n<900) return "D"+string(n/100-5,'C')+decimalToRoman(n%100); - if(n<1100) return string(10-n/100,'C')+"M"+decimalToRoman(n%100); - return string(n/1000,'M')+decimalToRoman(n%1000); -} - -int romanToDecimal(string str){ - if(str=="") return 0; - int res=0,j,m=0; - string :: iterator p=str.end(); - const char *q; - for(--p;;p--) { - for(q="IVXLCDM",j=0;*q;q++,j++) if(*p==*q) - res+=((j>=m)?m=j,1:-1)*(1+j%4/2*9)*(1+j/4*99)*(1+j%2*4); - if(p==str.begin()) break; - } - return res; -} diff --git a/README.md b/README.md deleted file mode 100644 index 7f4e914..0000000 --- a/README.md +++ /dev/null @@ -1,8 +0,0 @@ -Algorithm-Code-Library -====================== - -Library of my implementations of various algorithm and data-structures. Used by me for online contests. Written in C++. - -If you find any of the codes useful, I would love to hear from you. - -Email: mail2bidhan@gmail.com diff --git a/Sample Codes/Knuth Optimization ( Uva 10304 ).cpp b/Sample Codes/Knuth Optimization ( Uva 10304 ).cpp deleted file mode 100644 index bcaac1b..0000000 --- a/Sample Codes/Knuth Optimization ( Uva 10304 ).cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Bidhan Roy - * University of Dhaka - * Problem : Uva - 10304 Optimal Binary Search Tree - */ - -#include - -#define mx 260 -#define inf 1<<28 - -int a[mx]; - -int dp[mx][mx]; /// contains the optimal costs of intervals -int p[mx][mx]; /// contains the points by partitioning where we can get minimum cost -int sum[mx]; /// contains cumulative sum of the array - -int main(){ - int n; - while( scanf("%d",&n)==1 ){ - for(int i=0; i0) i=F[i]; - else j++; - } - return ret; -} diff --git a/String Algorithms & Data Structures/Manacher.cpp b/String Algorithms & Data Structures/Manacher.cpp deleted file mode 100644 index 9801e17..0000000 --- a/String Algorithms & Data Structures/Manacher.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author : Bidhan Roy - * Required Headers : ,; - * Complexity : O (|N|) - * If you find any bug report at : mail2bidhan@gmail.com - */ - -int call(char *inp,char *str,int *F,vector< pair > &vec){ - //inp is the actual string - //str is the modified string with double size of inp - //F[i] contains the length of the palindrome centered at index i - //Every element of vec cointains starting and ending positions of palindromes - int len=0; - str[len++]='*'; - for(int i=0; inp[i]; i++){ - str[len++]=inp[i]; - str[len++]='*'; - } - str[len]='\0'; - int c=0,r=0,ans=0; - for(int i=1; i < len-1; i++){ - int _i=c-(i-c); - if(r > i) F[i]=min(F[_i],r-i); - else F[i]=0; - while(i-1-F[i]>=0 && str[i-1-F[i]]==str[i+1+F[i]]) { - F[i]++; - } - if(i+F[i] > r) r=i+F[i],c=i; - ans=max(ans,F[i]); - vec.push_back(make_pair(i-F[i],i+F[i])); - } - return ans; -} diff --git a/String Algorithms & Data Structures/Minimum Lexicographical Rotation O ( N ) .cpp b/String Algorithms & Data Structures/Minimum Lexicographical Rotation O ( N ) .cpp deleted file mode 100644 index 9aceeca..0000000 --- a/String Algorithms & Data Structures/Minimum Lexicographical Rotation O ( N ) .cpp +++ /dev/null @@ -1,10 +0,0 @@ -int minmove(char *inp,int len){ - int ret=0,l=0,idx=1; - while(ret+l+1 tokenize( string a, string b ) { - const char *q = a.c_str(); - while( count( b.begin(), b.end(), *q ) ) q++; - vector< string > oot; - while( *q ) { - const char *e = q; - while( *e && !count( b.begin(), b.end(), *e ) ) e++; - oot.push_back( string( q, e ) ); - q = e; - while( count( b.begin(), b.end(), *q ) ) q++; - } - return oot; -} diff --git a/String Algorithms & Data Structures/Suffix Array.cpp b/String Algorithms & Data Structures/Suffix Array.cpp deleted file mode 100644 index 9c1e87b..0000000 --- a/String Algorithms & Data Structures/Suffix Array.cpp +++ /dev/null @@ -1,82 +0,0 @@ -namespace suffixArray{ - const int MAXN = 2005; /// Length of string - const int MAXL = 22; - int n ,stp,mv,suffix[MAXN],tmp[MAXN]; - int sum[MAXN],cnt[MAXN],rank[MAXL][MAXN]; - char str[MAXN]; - int LCP(int u,int v){ - int ret=0,i; - for(i = stp; i >= 0; i--){ - if(rank[i][u]==rank[i][v]){ - ret += 1< backLink; - - bool has ( char ch ) { - return next[ charToInt(ch) ] != -1; - } - }; - - int sz, last; - vector< state > Pool; - - void getAllOccurrence ( int v , int P_length , vector &ret ) { - if ( !Pool[v].isClone ) ret.pb( Pool[v].firstPos - P_length + 1 ); - for ( size_t i = 0; i < Pool[v].backLink.size(); i++ ) - getAllOccurrence ( Pool[v].backLink[i] , P_length , ret); - } - - public : - - SuffixAutomata( int maxlength ) { - Pool = vector ( maxlength * 2 ); - } - - void initialize() { - rep( i , sz ) Pool[i].backLink.clr, Pool[i].isClone = false, Pool[i].link = -1, Pool[i].len = 0; - sz = last = 0; - Pool[0].len = 0; - Pool[0].link = -1; - mem( Pool[sz].next , -1 ); - ++sz; - } - - void addChar ( char c ) { - int cur = sz++; - mem( Pool[cur].next , -1 ); - Pool[cur].len = Pool[last].len + 1; - Pool[cur].firstPos = Pool[cur].len - 1; - Pool[cur].isClone = false; - int p; - for ( p = last; p != -1 && !Pool[p].has(c) ; p = Pool[p].link ) Pool[p].next[ charToInt(c) ] = cur; - if ( p == -1 ) Pool[cur].link = 0; - else { - int q = Pool[p].next[ charToInt(c) ]; - if ( Pool[p].len + 1 == Pool[q].len ) Pool[cur].link = q; - else { - int clone = sz++; - mem( Pool[clone].next , -1 ); - Pool[clone].len = Pool[p].len + 1; - Pool[clone].firstPos = Pool[p].firstPos; - Pool[clone].isClone = true; - memcpy( Pool[clone].next , Pool[q].next , sizeof (Pool[q].next) ); - Pool[clone].link = Pool[q].link; - for ( ; p != -1 && Pool[p].next[charToInt(c)] == q; p = Pool[p].link ) - Pool[p].next[ charToInt(c) ] = clone; - Pool[q].link = Pool[cur].link = clone; - } - } - last = cur; - } - - void construct ( string &str ) { - rep( i , sz(str) ) addChar(str[i]); - for( int v=1; v getAllOccurrence ( string &pattern ) { - vector ret; - int v = findState( pattern ); - if( v == -1 ) return ret; - getAllOccurrence( v , sz(pattern) , ret ); - sort ( all ( ret ) ); - return ret; - } - - #undef charToInt -}; diff --git a/String Algorithms & Data Structures/Trie.cpp b/String Algorithms & Data Structures/Trie.cpp deleted file mode 100644 index 8b2d506..0000000 --- a/String Algorithms & Data Structures/Trie.cpp +++ /dev/null @@ -1,30 +0,0 @@ -struct Trie{ - Trie *next[alphabet+1]; - - Trie(){ for(int i=0; i<=alphabet; i++) next[i]=NULL; } - ~Trie(){ for(int i=0; i<=alphabet; i++) delete(next[i]); } - - void insert(char *str){ - /// inserting character array - Trie *curr=this; - for(int i=0; str[i]; i++){ - if(!curr->next[str[i]-'a']) - curr->next[str[i]-'a']=new Trie; - curr=curr->next[str[i]-'a']; - /// assuming, all the letters are in lowercase, - /// needs to be changed if otherwise - } - if(!curr->next[alphabet]) curr->next[alphabet]=new Trie; - } - - bool find(char *str){ - /// returns 'true' is string 'str' has been inserted in the trie - /// returns 'false' otherwise - Trie *curr=this; - for(int i=0; str[i]; i++){ - if(!curr->next[str[i]-'a']) return false; - curr=curr->next[str[i]-'a']; - } - return curr->next[alphabet]; - } -}; diff --git a/Templates/Debug Extensions.cpp b/Templates/Debug Extensions.cpp deleted file mode 100644 index ef50cae..0000000 --- a/Templates/Debug Extensions.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/// ********* debug template by Bidhan Roy ********* - -template < typename F, typename S > -ostream& operator << ( ostream& os, const pair< F, S > & p ) { - return os << "(" << p.first << ", " << p.second << ")"; -} - -template < typename T > -ostream &operator << ( ostream & os, const vector< T > &v ) { - os << "{"; - typename vector< T > :: const_iterator it; - for( it = v.begin(); it != v.end(); it++ ) { - if( it != v.begin() ) os << ", "; - os << *it; - } - return os << "}"; -} - -template < typename T > -ostream &operator << ( ostream & os, const set< T > &v ) { - os << "["; - typename set< T > :: const_iterator it; - for ( it = v.begin(); it != v.end(); it++ ) { - if( it != v.begin() ) os << ", "; - os << *it; - } - return os << "]"; -} - -template < typename F, typename S > -ostream &operator << ( ostream & os, const map< F, S > &v ) { - os << "["; - typename map< F , S >::const_iterator it; - for( it = v.begin(); it != v.end(); it++ ) { - if( it != v.begin() ) os << ", "; - os << it -> first << " = " << it -> second ; - } - return os << "]"; -} - -#define deb(x) cerr << #x << " = " << x << endl; diff --git a/Templates/google codejam template.cpp b/Templates/google codejam template.cpp deleted file mode 100644 index 2a09ebf..0000000 --- a/Templates/google codejam template.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Bidhan Roy - * University of Dhaka - */ - -using namespace std; -#include - -#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++) -#define sgn(x,y) ((x)+eps<(y)?-1:((x)>eps+(y)?1:0)) -#define rep(i,n) for(__typeof(n) i=0; i<(n); i++) -#define mem(x,val) memset((x),(val),sizeof(x)); -#define rite(x) freopen(x,"w",stdout); -#define read(x) freopen(x,"r",stdin); -#define all(x) x.begin(),x.end() -#define sz(x) ((int)x.size()) -#define sqr(x) ((x)*(x)) -#define pb push_back -#define mp make_pair -#define clr clear() -#define inf (1<<30) -#define ins insert -#define xx first -#define yy second -#define eps 1e-9 - -typedef long long i64; -typedef unsigned long long ui64; -typedef string st; -typedef vector vi; -typedef vector vs; -typedef map mii; -typedef map msi; -typedef set si; -typedef set ss; -typedef pair pii; -typedef vector vpii; - -#define mx 0 - -int main(){ - time_t start=clock(); - //read("in.txt"); - //rite("out.txt"); - ios_base::sync_with_stdio(0); - int test, kas=0; - cin>>test; - while( test-- ){ - cout<<"Case #"<<++kas<<": "; - } - cerr << " Program has run "<< ( clock()-start ) / CLOCKS_PER_SEC << " s " << endl; - return 0; -} diff --git a/Templates/online contest template (C++11).cpp b/Templates/online contest template (C++11).cpp deleted file mode 100644 index a17ab7b..0000000 --- a/Templates/online contest template (C++11).cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Bidhan Roy - * University of Dhaka - */ - -using namespace std; -#include - -#define rep(i,n) for(auto i=0; i<(n); i++) -#define mem(x,val) memset((x),(val),sizeof(x)); -#define rite(x) freopen(x,"w",stdout); -#define read(x) freopen(x,"r",stdin); -#define all(x) x.begin(),x.end() -#define sz(x) ((int)x.size()) -#define sqr(x) ((x)*(x)) -#define pb push_back -#define clr clear() -#define inf (1<<30) -#define ins insert -#define xx first -#define yy second -#define eps 1e-9 - -typedef long long i64; -typedef unsigned long long ui64; -typedef string st; -typedef vector vi; -typedef vector vs; -typedef map mii; -typedef map msi; -typedef set si; -typedef set ss; -typedef pair pii; -typedef vector vpii; - -#define mx 0 - -int main() { - ios_base::sync_with_stdio(0); - return 0; -} diff --git a/Templates/online contest template.cpp b/Templates/online contest template.cpp deleted file mode 100644 index b4b0f50..0000000 --- a/Templates/online contest template.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Bidhan Roy - * University of Dhaka - */ - -using namespace std; -#include - -#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++) -#define sgn(x,y) ((x)+eps<(y)?-1:((x)>eps+(y)?1:0)) -#define rep(i,n) for(__typeof(n) i=0; i<(n); i++) -#define mem(x,val) memset((x),(val),sizeof(x)); -#define rite(x) freopen(x,"w",stdout); -#define read(x) freopen(x,"r",stdin); -#define all(x) x.begin(),x.end() -#define sz(x) ((int)x.size()) -#define sqr(x) ((x)*(x)) -#define pb push_back -#define mp make_pair -#define clr clear() -#define inf (1<<30) -#define ins insert -#define xx first -#define yy second -#define eps 1e-9 - -typedef long long i64; -typedef unsigned long long ui64; -typedef string st; -typedef vector vi; -typedef vector vs; -typedef map mii; -typedef map msi; -typedef set si; -typedef set ss; -typedef pair pii; -typedef vector vpii; - -#define mx 0 - -int main(){ - ios_base::sync_with_stdio(0); - return 0; -} diff --git a/images/bkg.png b/images/bkg.png new file mode 100644 index 0000000..d10e5ca Binary files /dev/null and b/images/bkg.png differ diff --git a/images/blacktocat.png b/images/blacktocat.png new file mode 100644 index 0000000..9759d77 Binary files /dev/null and b/images/blacktocat.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..b5dbb69 --- /dev/null +++ b/index.html @@ -0,0 +1,40 @@ + + + + + + + + + + + Algorithm-code-library by BidhanRoy + + + + +
+
+

Algorithm-code-library

+

C++ Algorithm Code Library for Competitive Programming

+ +
+ Download as .zip + Download as .tar.gz + View on GitHub +
+
+
+ +
+
+

+Algorithm-Code-Library

+ +

Library of my implementations of various algorithm and data-structures. Written in C++.

+
+
+ + + + \ No newline at end of file diff --git a/javascripts/main.js b/javascripts/main.js new file mode 100644 index 0000000..d8135d3 --- /dev/null +++ b/javascripts/main.js @@ -0,0 +1 @@ +console.log('This would be the main JS file.'); diff --git a/params.json b/params.json new file mode 100644 index 0000000..c7d572d --- /dev/null +++ b/params.json @@ -0,0 +1 @@ +{"name":"Algorithm-code-library","tagline":"C++ Algorithm Code Library for Competitive Programming","body":"Algorithm-Code-Library\r\n======================\r\n\r\nLibrary of my implementations of various algorithm and data-structures. Written in C++.\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file diff --git a/stylesheets/pygment_trac.css b/stylesheets/pygment_trac.css new file mode 100644 index 0000000..d1df6a2 --- /dev/null +++ b/stylesheets/pygment_trac.css @@ -0,0 +1,68 @@ +.highlight .c { color: #999988; font-style: italic } /* Comment */ +.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ +.highlight .k { font-weight: bold } /* Keyword */ +.highlight .o { font-weight: bold } /* Operator */ +.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */ +.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ +.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ +.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #aa0000 } /* Generic.Error */ +.highlight .gh { color: #999999 } /* Generic.Heading */ +.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ +.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #555555 } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */ +.highlight .gt { color: #aa0000 } /* Generic.Traceback */ +.highlight .kc { font-weight: bold } /* Keyword.Constant */ +.highlight .kd { font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { font-weight: bold } /* Keyword.Pseudo */ +.highlight .kr { font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */ +.highlight .m { color: #009999 } /* Literal.Number */ +.highlight .s { color: #d14 } /* Literal.String */ +.highlight .na { color: #008080 } /* Name.Attribute */ +.highlight .nb { color: #0086B3 } /* Name.Builtin */ +.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */ +.highlight .no { color: #008080 } /* Name.Constant */ +.highlight .ni { color: #800080 } /* Name.Entity */ +.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */ +.highlight .nn { color: #555555 } /* Name.Namespace */ +.highlight .nt { color: #CBDFFF } /* Name.Tag */ +.highlight .nv { color: #008080 } /* Name.Variable */ +.highlight .ow { font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mf { color: #009999 } /* Literal.Number.Float */ +.highlight .mh { color: #009999 } /* Literal.Number.Hex */ +.highlight .mi { color: #009999 } /* Literal.Number.Integer */ +.highlight .mo { color: #009999 } /* Literal.Number.Oct */ +.highlight .sb { color: #d14 } /* Literal.String.Backtick */ +.highlight .sc { color: #d14 } /* Literal.String.Char */ +.highlight .sd { color: #d14 } /* Literal.String.Doc */ +.highlight .s2 { color: #d14 } /* Literal.String.Double */ +.highlight .se { color: #d14 } /* Literal.String.Escape */ +.highlight .sh { color: #d14 } /* Literal.String.Heredoc */ +.highlight .si { color: #d14 } /* Literal.String.Interpol */ +.highlight .sx { color: #d14 } /* Literal.String.Other */ +.highlight .sr { color: #009926 } /* Literal.String.Regex */ +.highlight .s1 { color: #d14 } /* Literal.String.Single */ +.highlight .ss { color: #990073 } /* Literal.String.Symbol */ +.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */ +.highlight .vc { color: #008080 } /* Name.Variable.Class */ +.highlight .vg { color: #008080 } /* Name.Variable.Global */ +.highlight .vi { color: #008080 } /* Name.Variable.Instance */ +.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ + +.type-csharp .highlight .k { color: #0000FF } +.type-csharp .highlight .kt { color: #0000FF } +.type-csharp .highlight .nf { color: #000000; font-weight: normal } +.type-csharp .highlight .nc { color: #2B91AF } +.type-csharp .highlight .nn { color: #000000 } +.type-csharp .highlight .s { color: #A31515 } +.type-csharp .highlight .sc { color: #A31515 } diff --git a/stylesheets/stylesheet.css b/stylesheets/stylesheet.css new file mode 100644 index 0000000..a54a639 --- /dev/null +++ b/stylesheets/stylesheet.css @@ -0,0 +1,247 @@ +body { + margin: 0; + padding: 0; + background: #151515 url("../images/bkg.png") 0 0; + color: #eaeaea; + font: 16px; + line-height: 1.5; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; +} + +/* General & 'Reset' Stuff */ + +.container { + width: 90%; + max-width: 600px; + margin: 0 auto; +} + +section { + display: block; + margin: 0 0 20px 0; +} + +h1, h2, h3, h4, h5, h6 { + margin: 0 0 20px; +} + +li { + line-height: 1.4 ; +} + +/* Header,
+ header - container + h1 - project name + h2 - project description +*/ + +header { + background: rgba(0, 0, 0, 0.1); + width: 100%; + border-bottom: 1px dashed #b5e853; + padding: 20px 0; + margin: 0 0 40px 0; +} + +header h1 { + font-size: 30px; + line-height: 1.5; + margin: 0 0 0 -40px; + font-weight: bold; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; + color: #b5e853; + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1), + 0 0 5px rgba(181, 232, 83, 0.1), + 0 0 10px rgba(181, 232, 83, 0.1); + letter-spacing: -1px; + -webkit-font-smoothing: antialiased; +} + +header h1:before { + content: "./ "; + font-size: 24px; +} + +header h2 { + font-size: 18px; + font-weight: 300; + color: #666; +} + +#downloads .btn { + display: inline-block; + text-align: center; + margin: 0; +} + +/* Main Content +*/ + +#main_content { + width: 100%; + -webkit-font-smoothing: antialiased; +} +section img { + max-width: 100% +} + +h1, h2, h3, h4, h5, h6 { + font-weight: normal; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; + color: #b5e853; + letter-spacing: -0.03em; + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1), + 0 0 5px rgba(181, 232, 83, 0.1), + 0 0 10px rgba(181, 232, 83, 0.1); +} + +#main_content h1 { + font-size: 30px; +} + +#main_content h2 { + font-size: 24px; +} + +#main_content h3 { + font-size: 18px; +} + +#main_content h4 { + font-size: 14px; +} + +#main_content h5 { + font-size: 12px; + text-transform: uppercase; + margin: 0 0 5px 0; +} + +#main_content h6 { + font-size: 12px; + text-transform: uppercase; + color: #999; + margin: 0 0 5px 0; +} + +dt { + font-style: italic; + font-weight: bold; +} + +ul li { + list-style: none; +} + +ul li:before { + content: ">>"; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; + font-size: 13px; + color: #b5e853; + margin-left: -37px; + margin-right: 21px; + line-height: 16px; +} + +blockquote { + color: #aaa; + padding-left: 10px; + border-left: 1px dotted #666; +} + +pre { + background: rgba(0, 0, 0, 0.9); + border: 1px solid rgba(255, 255, 255, 0.15); + padding: 10px; + font-size: 14px; + color: #b5e853; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + text-wrap: normal; + overflow: auto; + overflow-y: hidden; +} + +table { + width: 100%; + margin: 0 0 20px 0; +} + +th { + text-align: left; + border-bottom: 1px dashed #b5e853; + padding: 5px 10px; +} + +td { + padding: 5px 10px; +} + +hr { + height: 0; + border: 0; + border-bottom: 1px dashed #b5e853; + color: #b5e853; +} + +/* Buttons +*/ + +.btn { + display: inline-block; + background: -webkit-linear-gradient(top, rgba(40, 40, 40, 0.3), rgba(35, 35, 35, 0.3) 50%, rgba(10, 10, 10, 0.3) 50%, rgba(0, 0, 0, 0.3)); + padding: 8px 18px; + border-radius: 50px; + border: 2px solid rgba(0, 0, 0, 0.7); + border-bottom: 2px solid rgba(0, 0, 0, 0.7); + border-top: 2px solid rgba(0, 0, 0, 1); + color: rgba(255, 255, 255, 0.8); + font-family: Helvetica, Arial, sans-serif; + font-weight: bold; + font-size: 13px; + text-decoration: none; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.75); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); +} + +.btn:hover { + background: -webkit-linear-gradient(top, rgba(40, 40, 40, 0.6), rgba(35, 35, 35, 0.6) 50%, rgba(10, 10, 10, 0.8) 50%, rgba(0, 0, 0, 0.8)); +} + +.btn .icon { + display: inline-block; + width: 16px; + height: 16px; + margin: 1px 8px 0 0; + float: left; +} + +.btn-github .icon { + opacity: 0.6; + background: url("../images/blacktocat.png") 0 0 no-repeat; +} + +/* Links + a, a:hover, a:visited +*/ + +a { + color: #63c0f5; + text-shadow: 0 0 5px rgba(104, 182, 255, 0.5); +} + +/* Clearfix */ + +.cf:before, .cf:after { + content:""; + display:table; +} + +.cf:after { + clear:both; +} + +.cf { + zoom:1; +} \ No newline at end of file