GithubHelp home page GithubHelp logo

ccebinger / acm_uva_algorithmic_problem_solving Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stevedengzishi/acm_uva_algorithmic_problem_solving

0.0 1.0 0.0 47 KB

C++ Competitive Programming templates

C++ 100.00%

acm_uva_algorithmic_problem_solving's Introduction

This repository contains useful templates for competitive programming that can be used in ACM and UVa problem solving.

Using C++ 5.3.0 with -std=c++11

Some templates are written by myself and some are inspired by other talented authors and then modified to either general or specific usage.

Contents Table:

Template:

    General template for c++ competitive problem solving

Special Data Structures:

    Union-Find or Disjointed set implementation
    Fenwick Tree(Binary Indexed Tree) implementation
    Segment Tree implementation
    //Suffix Tree

Techniques:

    Longest Increasing Subseqence(LIS)
    Maximum Sum Subarray(Kadane's Algorithm)
    Dynamic Programming + Memoization

Graph Algorithms:
    
    UNWEIGHTED SHORTEST PATH:
    Breath First Search(BFS) O(V+E)
    Depth First Search(DFS) O(V+E)

    WEIGHTED SHORTEST PATH:
    Dijkstra's algorithm --- single-source shortest path problem. O(ElogV) E times logV using extract min from heap
    Bellman–Ford algorithm --- single-source problem if edge weights may be negative. O(VE) O(V^2) on sparse O(V^3) on dense.
    Floyd–Warshall algorithm --- all pairs shortest paths. O(V^3) dp three for loop ijk
    //Johnson's algorithm --- all pairs shortest paths, and may be faster than Floyd–Warshall on sparse graphs.
    SPFA(Shortest Path Faster Algorithm) --- Improve performance of Bellman-Ford
    
    UNWEIGHTED ORDERING:
    Topological Sort(dfs + stack)

    MINIMUM SPANNING TREE:
    Kruskal's algorithm
    Prim's algorithm

    MAXFLOW MIN-CUT:
    Ford-Fullkerson algorithm

    ARTICULATION & BRIDGES:
    Tarjan's Algorithm

String Algorithms:
    
    Violent string matching O(TP)
    Knuth-Morris-Pratt(KMP) O(T+P)

Geometry:
    
    Graham scanning(Convex Hull) O(n^2 log n)

Created by DENG ZISHI on 2/17/17. Copyright © 2017 DENG ZISHI. All rights reserved.

acm_uva_algorithmic_problem_solving's People

Contributors

stevedengzishi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.