Giter Site home page Giter Site logo

nthu-cpp's People

Contributors

aftermaaath avatar cy-chang avatar didwhddks avatar fffelix-huang avatar harry900831 avatar jacky860226 avatar lawrence910426 avatar lotanie avatar oohwee-yju avatar polarischiba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nthu-cpp's Issues

Add Monotone optimization(四邊形優化)

Outline

  • Definition of concave/convex totally monotone
  • 1D/1D concave/convex monotone
    • 1D/1D common form
    • Transform the problem into a two-dimensional array extremum query
    • using monotonicity to speed up dp calculation
    • Implement & application
  • Monge condition
    • Theory and equivalent form
    • Proof Monge condition implies monotonic split point
  • Knuth Optimization - 2D/1D convex monotone (四邊形優化)
    • 2D/1D common form
    • monotonic split point speed up calculation
    • Time complextiy
    • Implement & application
  • Transfer point monotonic (轉移點單調)
    • main processing form
    • ARC067 D

References

https://tioj.ck.tp.edu.tw/uploads/attachment/11/54/7.pdf
https://slides.com/kevin_zhang/deck-8c1c8e/
http://www.chino.taipei/code-2016-0402Algorithm-DP優化之四邊形不等式優化/
http://pisces.ck.tp.edu.tw/~peng/index.php?action=showfile&file=f4c79992d9e0b5ee4aa9fd7db9115c673b2cf6150
http://momo-funnycodes.blogspot.com/2012/06/tioj-1449-extreme.html
https://cp-algorithms.com/dynamic_programming/knuth-optimization.html
https://oi-wiki.org/dp/opt/quadrangle/
https://core.ac.uk/download/pdf/82676028.pdf

Add Centroid Decomposition

Introduction to Centroid Decomposition

Centroids

  • What is a centroid
  • How to find centroids
  • Application

Centroid Tree

  • What is a centroid tree
  • How to build a centroid tree
  • Property

Problems

  • Codeforces Xenia and Tree
  • Codeforces Ciel the Commander
  • CSES Fixed-Length Paths I
  • CSES Fixed-Length Paths II
  • Codeforces Close Vertices
  • CS academy Black-White-Tree

References

  • USACO Guide, Centroid Decomposition
  • oi wiki, 樹分治
  • Codeforces, Centroid Decomposition on a tree(Beginner)

Add Game Theory

Todo list for release

  • foreword
  • Introduction to CP an NTHU CP Team
  • How to Practice
  • Calendar
  • Update Contest information
  • Update contribution note
  • Update useful resources
  • doc for clerical work if you want to host an event or apply for reimbursement
  • C++ programming tips
  • Give each topic an intro.md
  • Update GitHub repo information
  • Google analytic of the website

Add Flow

Outlines

  • Introduction to Network Flow and definition of some terms
  • State and prove The Max-flow Min-cut Theorem
  • Ford-Fulkerson's algorithm
    • Introduction to Augmenting path
    • A common wrong method of finding max-flow
    • Detail process of the algorithm
    • Time complexity and the correctness of the algorithm
    • Template code
  • Edmonds-Karp's algorithm
    • The flaw of Ford-Fulkerson's algorithm and the method of optimization
    • Detail process of the algorithm
    • Time complexity and the correctness of the algorithm
    • Template code
  • Solving some related problems

References

Add chapter Graph

  • Graph Definition
  • Graph Storage
  • Graph Traversal
  • Tree Definition
  • Binary Tree Traversal

Add Fast Fourier Transform (FFT)

Introduction to Fast Fourier Transform (FFT)

Mathematical Background

  • The principal nth root of unity
  • Representing polynomials
    • Coefficient representation
    • Point-value representation
  • Vandermonde matrix and its properties

DFT && Inverse DFT

  • Introduction
  • Calculation (by Vandermonde matrix)

FFT algorithm

  • Find DFT
  • Divide and conquer
  • Find Inverse DFT

Exercises

  • Easy
    • SPOJ Polynomial Multiplication [3]
  • Medium
    • SPOJ Maximum Self-Matching [4]
    • SPOJ Ada and Nucleobase [5]
    • Codeforces Yet Another String Matching Problem [6]
    • Codeforces Lightsabers (hard) [7]
    • Codeforces Running Competition [8]
    • Codeforces Dasha and cyclic table [9]
    • Kattis A+B Problem [10]
    • Kattis K-Inversions [11]

References

Add Inversion Pair

Outline

  • Definition & mathematical meanings
  • Upper bound of # inversions & lower bound of comparison-based sorting
  • Efficient approaches to count inversions
    • Merge sort
    • Data structures that support single update and range query like BIT (a.k.a. Fenwick tree)
    • Data structures that support $k^\text{th}$ query
  • Problems related to inversions
  • Dynamic inversions
  • Other pairwise problems

Problems

Reference

In fact, there are few online resources that is mainly focused on inversions :(

Add Aliens Optimization

Add KMP

Outline:

  • Introduction to KMP algortithm
    • Prefix function
    • Time complextiy
    • Search for a substring in a string
  • Applications
    • Counting the number of occurrences of each prefix
    • The number of different substring in a string
    • Remove all occurrences of string t in string s using KMP Algorithm
    • Automaton of KMP

Problems:

https://codeforces.com/problemset/problem/535/D
https://codeforces.com/problemset/problem/471/D
https://codeforces.com/contest/432/problem/D

Reference:

https://cp-algorithms.com/string/prefix-function.html
https://oi-wiki.org/string/kmp/
https://www.geeksforgeeks.org/remove-all-occurrences-of-string-t-in-string-s-using-kmp-algorithm/?ref=rp
https://labuladong.gitbook.io/algo-en/i.-dynamic-programming/kmpcharactermatchingalgorithmindynamicprogramming#i.-overview-of-kmp-algorithm

Add chapter Segment Tree Beats

Introduction to Segment Tree Beats

  • Construct tree node (sum, max1, max2, maxc, min1, min2, minc, lazy tag)
  • Construct tree (build)
  • Range modification
    • update_add / push_add
    • update_max / push_max
    • update_min / push_min
    • push_down
  • Merge functions
  • Range query

Add chapter Bit operation and their trick

  • Introduction to bit and bytes
  • Basic bit operation / truth table
  • Some trick for using bit operation
  • Eight queen
  • Bit representation / bitmask
  • Enumerate all subset and submask

Add Treap

Treap

Introduction to Treap

//Definition of Binary Search Tree, Heap, and Treap

Split-Merge Tree

Introduction

//How it keep self to balance

Treap node

//Create a Treap node

Merge

//Merge two Treap nodes

Split by key

//according to node's key split it to two nodes

Erase, Insert, K-th element, ... some BST operation

Range Queries

//Split by size, save information in Treap node, pull (merge two nodes and update information)

Lazy Tag

//how to push Treap node's lazy tag to node's son

Range Reverse

//use lazy tag to reverse

O(N) build a Treap

//introduction to cartesian tree

Proof Treap's deep is logN

Problems

//some problems use treap will be better or only can use treap to solve it
//for example: TIOJ 1169, cf 702F

References

https://codeforces.com/blog/entry/84017
https://oi-wiki.org/ds/treap/
https://oi-wiki.org/ds/cartesian-tree/
https://cp-algorithms.com/data_structures/treap.html
https://usaco.guide/adv/treaps?lang=cpp

//sorry for my poor English :(

Misc: Introduction to Interactive

Outline:

What's Interactive Problem

Example: Binary Search

Exercises

Codeforces 727C

Codeforces 809B

Codeforces 843B

Codeforces 835E

Codeforces 750F

Codeforces 1033E

Add Convex Hull Trick

Outline

Introduction

斜率/查詢皆單調

說明斜率優化觀念、使用 deque

  • 點不用被 pop
  • 點需要被 pop

查詢不單調、斜率單調

使用二分搜

斜率不單調

  • 李超線段樹
  • 動態凸包
  • CDQ

/*
以上每個部分都有:

  • 例題
  • 提出觀察、列出&整理轉移式
  • 時間複雜度、實作細節
  • 範例 code
  • 總結作法與重點

*/

總結

  • 統整各情況、列出思考的步驟

Exercises

References

Add Persistent segment tree

Add SCC and 2-SAT

Introduction to Strongly Connected Component

Definition

Property

SCC Compression

Detail process

Time complexity and the correctness

Template code

Tarjan's Algorithm for SCC

Detail process

Time complexity and the correctness

Template code

Kosaraju's Algorithm

Detail process

Time complexity and the correctness

Template code

Introduction to 2-SAT problem

Definition

Transfer 2-SAT to a Graph

Krom's Algorithm

Problems

Add Dynamic Programming on Trees

Add AP, Bridge and BCC

Add chapter Basic Number Theory

Binary Exponentiation

  • Integer version
  • Matrix version
  • Implementation
  • Examples

Sieve of Eratosthenes

  • Finding Prime Numbers
  • Implementation
  • Examples

Sieve of Euler

  • Yet Another Finding Prime Numbers
  • Implementation
  • Examples

Greatest Common Divisor

  • Properties
  • Bézout's identity
  • Extended Euclidean Algorithm
  • Implementation
  • Examples (e.g. Solving Linear Diophantine Equation)

Modular Arithmetic

  • Modular Inverse
  • Fermat's Little Theorem
  • Extended Euclidean algorithm
  • Finding the Modular Inverse for Array of Numbers Modulo any Positive Integer m
  • Implementation
  • Examples

Add chapter disjoint set

  • Definition of set, disjoint set
  • Naive find, union
  • Time complexity of naive disjoint set
  • Path compression and union by rank
  • Optimized time complexity
  • Template of disjoint set with explanation
  • Problem set

Add Gauss-Jordan elimination

Add CDQ and Parallel Binary Search

Outline

  • CDQ Divide & Conquer
    • Introduction to partial order
    • N(>=2)-D partial order and examples
    • DP optimization
    • Operation Problems (操作分治)
  • Parallel Binary Search
    • Concept
    • DP optimization
    • More examples

Reference

Add LCA

Outline

  • Definition of lowest common ancestor (LCA)
  • Common implementations for finding LCA
    • Brute force
    • Binary lifting
    • Reduce to RMQ problem with Euler tour
      • How to reduce to RMQ problem
      • Some useful methods on solving RMQ (mentioned)
      • Farach-Colton and bender algorithm (detailed)
    • Tarjan's offline algorithm
    • Heavy path decomposition
    • Some related problems
  • Reduction from RMQ problem to LCA problem with Cartesian tree
  • Summary

References

Add Heavy Light Decomposition

  • Introduce to Heavy Light Decomposition

    • Intro
    • Definition of Heavy Node and Light Node
  • Properties

    • All nodes belong to a heavy chain
    • Complete Decomposition
    • dfs time stamp is continuous
  • Implementation

    • dfs first time to record father, deep, size, heavy node
    • dfs second time to construct heavy chain and light chain
    • Build data structures on each heavy chain
    • Queries
    • Definition of variables and code
  • Prove the time complexity

  • Problems

  • Reference

Z algorithm

  1. 大綱:
    Z algorithm介紹
    實作程式碼
    Z array性質
    相關題目

Add Trie

Outlines

  • Trie basics (insert, delete, find)
  • Binary on trie (01trie)
  • Persistent trie
  • Sample code (basic / binary / persistent)
  • Problem set
    • dictionary problem
    • maximum xor sum path on tree
    • maximum xor sub-array
    • given int x and a set S, maximize x ^ y for y in S
    • given int x and a array A, maximize x ^ y for y in A[L: R]

References

Add Linck cut tree

Add Generating Function

Add chapter brute force

  • Simple Complete Search
  • Complete Search with Recursion
  • Advance Technique for Complete Search
  • Aesthetics of Brute Force

Add chapter Binary Search

  • Basic of Binary Search
  • Recursive Binary Search
  • Iterative Binary Search
  • close/open interval
  • Binary Search on Answer
  • Problem set

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.