• 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

  • 相关阅读:
    rabbitmq在ios中实战采坑
    网络七层架构一句话简述
    HystrixCommand实战
    前端SEO技巧
    前端面试-难点问题2-java和javascript的区别
    前端面试题--难点问题
    [微信营销企划之路]003.Access forbidden!
    [Python进阶]001.不定参数
    [安卓基础]011存储数据(中)——sqlite语法介绍
    [JavaWeb基础] 015.Struts2 表单验证框架
  • 原文地址:https://www.cnblogs.com/utank/p/4077863.html
Copyright © 2020-2023  润新知