• What are the 10 algorithms one must know in order to solve most algorithm challenges/puzzles?


    QUESTION :

    What are the 10 algorithms one must know in order to solve most algorithm challenges/puzzles?

    ANSWER:

    Dynamic Programming (DP) appears to account for a plurality (some estimate up to a third) of contest problems. Of course, DP is also not a single algorithm that you can just learn once and retain, so maybe this doesn't answer your question.

    I suppose it also depends on whether you consider data structures in the same category as algorithms. There are certainly some data structures that you should be familiar with if you want to do well in programming competitions. The most important ones are range trees (variously known as interval trees or segment trees) and binary indexed trees (BITs), also known as Fenwick trees. Additionally, many DP algorithms make use of a prefix sum array.

    The most essential of the single algorithms I can think of are the following, in no particular order. However, you may be disappointed by how rarely some of these actually appear in contests. Most non-DP problems appear to be of the "ad hoc with data structures" variety, and you simply have to practice in order to get good at them.

    (To be clear, again, I list below only algorithms that take a single input set, compute some function of it, and carry no state between inputs. This distinguishes them from data structures, which by definition hold state, and categories of algorithms and algorithmic techniques like DP, which don't have some specific function they compute.)

      • Sieve of Eratosthenes, or another prime number sieve
      • Depth-first search
      • Breadth-first search
      • Dijkstra's algorithm
      • Floyd--Warshall algorithm
      • Either Kruskal's or Prim's algorithm
      • Some implementation of topological sorting, such as by using DFS
      • Convex hull (I recommend the Monotone Chains algorithm)
      • Coordinate compression
      • Edmonds--Karp, or another implementation of the Ford--Fulkerson method; or a preflow-push algorithm; or, if you are preparing an ACM codebook, Dinic's algorithm. (Note: Max flow is not allowed to appear on the IOI, but may nevertheless appear on national team-selection contests)

    -- By Brian Bi

    Excerpt from :https://www.quora.com/What-are-the-10-algorithms-one-must-know-in-order-to-solve-most-algorithm-challenges-puzzles

  • 相关阅读:
    android 瀑布流的实现详解,附源码
    NodeJs新手学习笔记之工具准备
    android app的类响应式设计
    开源一个友盟 for android 操作的封装包
    谈谈多门程序语言的学习策略之一
    谈谈android 布局 的优化
    android 滑动指引页的设计
    彻底弄懂CSS盒子模式
    关于内容管理系统IWMS的几个问题
    数码相机常用英文缩写对照表
  • 原文地址:https://www.cnblogs.com/utank/p/4077863.html
Copyright © 2020-2023  润新知