算法编程Algos Programming

不同算法的集合,用于编程比赛,如ACM ICPC。

算法按主题划分。大多数算法都可以从文件中按原样运行。每种算法都有一个参考问题,并对其时间和空间复杂度作了一些说明。

参考:https://github.com/ADJA/algos

算法列表List of algorithms

动态(优化,规划)编程Dynamic Programming

Convex Hull trick – Convex Hull trick is a geometry based dynamic programming modification.
Longest Increasing Sequence – Fast way to find longest increasing subsequence (subsequence in which each next element is greater than previous).
凸壳(面,包,集)技巧–凸壳技巧是基于几何的动态规划修改。
最长递增序列–快速找到最长递增子序列(其中每个下一个元素大于前一个元素的子序列)。

数据结构Data Structures

Cartesian Tree – Cartesian tree is a randomized balanced binary search tree.
Cartesian Tree with implicit keys – Cartesian tree with implicit keys is a powerful modification of cartesian tree, which can be used to solve many interesting problems. This implementation solves the problem of finding range minimum and also can perform reverse of an array segment.
Fenwick tree – Fenwick tree is a simple and easy-to-write data structure which can be used to find the value of some reversible function on the interval and also change the value of some element. This implementation can find the sum on the interval and update any arbitrary element.
Fenwick tree 2D – Extension of Fenwick tree on 2D case. This code can find the sum on the rectangle and update any arbitrary element.
Implicit segment tree – Implicit segment tree is a modification of segment tree which creates nodes only when they are needed. It can be used on big intervals like [1…109].
This code performs addition on the interval and getting the value of some
element.
Queue with minimum – Modification of queue, which allows finding the minimum element in it.
Segment Tree (Add-Min-Max) – Segment tree is a powerful data structure which can perform many operations on the intervals in O(logN) time. This implementation performs addition and min/max interval.
Segment Tree (Assign-Sum) – Segment tree implementation that performs assignment and gets the sum on the interval.
Segment Tree (minimum on a segment and update) – Segment tree. Solves RMQ problem (maximum on a segment and value update).
Sparse table – Solves static RMQ problem (range minimum/maximum query without element changes).

几何学Geometry
(Code 2) – Divide-and-conquer approach to find the closest pair of points.
Convex Hull (Code 2) – Graham-Andrew and Graham scan methods to find convex hull (the least convex polygon containing all given points).

图论Graphs

Bellman-Ford algorithm – Bellman-Ford algorithm finding shortest distances from a single vertex in graph.
Bipartite matching – Kuhn algorithm for maximum matching in bipartite graph.
Bridges search– Algorithm for finding all bridges in the graph (edges, after removal of which graph divides into several components).
Centroid decomposition – Centroid decomposition of a tree.
Cutpoints search – Algorithm for finding all cutpoints in the graph (vertices, after removal of which graph divides into several components).
Dijkstra algorithm
(set version) – Finding minimum distances from the single source with Dijkstra algorithm.
No negative edges are allowed. Best for sparse graphs. Two versions using set and heap.
Dinic maxflow – Dinic algorithm with scaling for finding the maximum flow.
Eulerian path/cycle – Algorithm for finding the Eulerian path/cycle, i.e. path/cycle that visits every edge of the graph exactly once.
Floyd-Warshall algorithm– Floyd-Warshall algorithm finding shortest distance between all pairs of vertices in graph.
Ford-Fulkerson maxflow – Ford-Fulkerson algorithm for finding the maximum flow.
Heavy-light decomposition – Heavy-light decomposition with segment trees in paths. Used for finding maximum on the path between two vertices.
Hungarian matching– Hungarian algorithm for solving the assignment problem.
LCA. Binary ascent. – Finding LCA (Least common ancestor) of two vertices in the tree. Uses dp calculated on powers of 2.
LCA. Heavy-light decomposition. – Finding LCA (Least common ancestor) of two vertices in the tree. Uses heavy-light decomposition.
MinCost MaxFlow Dijkstra (Heap Dijkstra)
– Solution to MinCost MaxFlow (or simply MinCost Flow) using Dijkstra algorithm with potentials as shortest path search method.
MinCost MaxFlow Ford-Bellman – Solution to MinCost MaxFlow (or simply MinCost Flow) using Ford-Bellman algorithm as shortest path search method.
Minimum spanning tree.
Kruskal algorithm – Kruskal algorithm for finding the minimum spanning tree (tree connecting the given graph with minumim sum of edges).
Minimum spanning tree.
Prim algorithm – Prim algorithm for finding the minimum spanning tree (tree connecting the given graph with minumim sum of edges).

数论Number Theory

BigInt – Structure implementing long arithmetic in C++. Analogous to BigInteger in Java.
Catalan numbers – Finding Nth Catalan number modulo some mod (mod is not necessary prime).
Uses Eratosthenes sieve for fast factorization.
Diophantine equation – Solving Diophantine equations in form of a * x + b * y = c. Uses extended Euclid algorithm (which finds such x, y that a * x + b * y = gcd(a, b)).
Fast Fourier transformation – Fast Fourier transformation used to multiply long numbers. Fast non-recursive version.
Gauss – Gauss method of solving systems of linear algebraic equation.
Matrix – Matrix multiplication and fast binary power.
Number by permutation – Finding number of permutation in lexicographical order.
Permutation by number – Finding permutation by its length and number in lexicographical order.

其它Other

Expression result calculation – Calculation of the value of the algebraic expression (like 2 * (5 + 7) - 25 / 5). Uses recursive descend. See code for the list of supported operations.
Merge sort – Merge sort for sorting the array of integers.
Quick sort – Quick sort with random pivoting for sorting the array of integers.
Radix sort – Radix sort for sorting the array of integers.

字符串Strings

Aho-Corasick – Aho-Corasick algorithm. This code finds all words in the text that contain any of the initially given words.
Hashing – Hashing in strings based problems. This code compares substrings using two hashes (one uses 2^64 as a modulo, another 10^9 + 7).
Manacher’s algorithm – Manacher’s algorithm for finding all subpalindromes in the string.
Palindrome tree – Useful structure to deal with palindromes in strings. This code counts number of palindrome substrings of the string.
Prefix function– Calculating the prefix function of the given string.
Suffix Array –Building suffix array in O(NlogN). Also LCP array is calculated. This code counts number of different substrings in the string.
Trie – Builds trie (tree with characters on the edges) from the set of strings. This code counts number of different substrings in the string.
Suffix Tree. Ukkonen’s algorithm – Ukkonen’s algorithm for building the suffix tree. Uses sibling lists in the nodes. This code counts number of different substrings in the string.
Z function – Calculating the Z-function of the given string.

算法编程Algos Programming相关推荐

  1. [PBRT翻译] PBRT阅读:第一章 1.1文学编程(Literate Programming)

    转载自PBRT阅读:第一章 1.1文学编程(Literate Programming) http://www.opengpu.org/bbs/forum.php?mod=viewthread& ...

  2. PBRT阅读:第一章 1.1文学编程(Literate Programming)

    转载自PBRT阅读:第一章 1.1文学编程(Literate Programming)http://www.opengpu.org/bbs/forum.php?mod=viewthread&t ...

  3. C算法编程题(四)上三角

    前言 上一篇<C算法编程题(三)画表格> 上几篇说的都是根据要求输出一些字符.图案等,今天就再说一个"上三角",有点类似于第二篇说的正螺旋,输出的字符少了,但是逻辑稍微 ...

  4. 【面试锦囊】14种模式搞定面试算法编程题(1-7)

    面试锦囊之知识整理系列 面试锦囊系列一直有收到大家的反馈,包括后台内推成功的消息.朋友的同事从创业小公司成功跳到huawei等等,非常高兴小破号的这些整理分享能够真正地帮助到大家,以后也会继续.为了更 ...

  5. 【面试锦囊】14种模式搞定面试算法编程题(8-14)

    面试锦囊之知识整理系列 面试锦囊系列一直有收到大家的反馈,包括后台内推成功的消息.朋友的同事从创业小公司成功跳到huawei等等,非常高兴小破号的这些整理分享能够真正地帮助到大家,以后也会继续.为了更 ...

  6. C算法编程题(二)正螺旋

    前言 上一篇<C算法编程题(一)扑克牌发牌> 写东西前总是喜欢吐槽一些东西,还是多啰嗦几句吧,早上看了一篇博文<谈谈外企涨工资那些事>,里面楼主讲到外企公司包含的五类人,其实不 ...

  7. 【算法学习】图相关算法编程实现-深度优先遍历和广度优先遍历

    一.图的表示 图G=(V,E).要表示一个图,通常有两种方法:邻接表和邻接矩阵.两种方法都既可以表示有向图,也可以表示无向图. 邻接表表示由一个包含|V|个列表的数组组成,其中每个列表对应V中的一个顶 ...

  8. C算法编程题(七)购物

    前言 上一篇<C算法编程题(六)串的处理> 有些朋友看过我写的这个算法编程题系列,都说你写的不是什么算法,也不是什么C++,大家也给我提出用一些C++特性去实现问题更方便些,在这里谢谢大家 ...

  9. system verilog编程题_拼多多2020校招部分算法编程题合集

    拼多多2020校招部分算法编程题2道,多多的魔术盒子和多多的排列函数 其实根据他的匹配职位我们可以看到,这5道题的难度还是并不高,只是作为一个初步筛选,我这边选择了前两道跟大家分享 [编程题一] 多多 ...

最新文章

  1. ASP.NET.4.5.1+MVC5.0系统角色和权限讲解
  2. 递归算法小结(数的阶乘、斐波那契和汉诺塔问题)
  3. 如何使用adb命令发送keyevent
  4. 【加速实践】番外篇:numbajit
  5. hive 分区_代码 | Spark读取mongoDB数据写入Hive普通表和分区表
  6. 【mybatis-plus】什么是乐观锁?如何实现“乐观锁”
  7. Bootstrap3 排版-改变大小写
  8. 明天 | 2021单细胞组学国际研讨会(线上)【附直播链接】
  9. EntityFramework 4.1 如何加入项目
  10. CVE-2013-3346Adobe Reader和Acrobat 内存损坏漏洞分析
  11. oracle undoautotune,Oracle 隐藏参数:_undo_autotune、一个吃力不讨好的活
  12. 一个简单51c语言程序,求一个 89C51 简易计算器的c语言程序 只要加减乘除就行!...
  13. 如何将Eclipse 的JavaWeb工程部署到Tomcat的webapps目录下
  14. 16复变函数的积分(二)
  15. 多项目结构_[网红项目]碳云大厦
  16. ORA-00904:quot;T1quot;.quot;AREA_IDquot; :标识符无效
  17. maxwell render中文版
  18. 新浪股票数据接口获取
  19. linux数据库删除命令大全,linux删除数据库命令
  20. 小白的python学习实录 基础篇(八)面向对象

热门文章

  1. 2021-2027年中国室内定位市场研究及前瞻分析报告
  2. 剑指offer 40.最小的 K 个数 python代码
  3. java集合中对象某属性比较排序
  4. 英特尔 QLC 3D NAND 数据存储
  5. 快手推荐系统及 Redis 升级存储
  6. 客快物流大数据项目(二十二):Docker环境中安装软件
  7. php连接mysql页面空白_求大神: php注册页面跳转出现空白页
  8. python sys.argv[] 的作用
  9. TypeError(“cannot concatenate ‘str‘ and ‘instancemethod‘ objects“,)
  10. RxJava 变换操作符Map