zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    winfrom让窗体在屏幕右下角慢慢向上弹出
    winfrom的StatusStrip控件如何设置控件右对齐
    Winfrom通过Panel拖动无边框窗体
    优秀学习资源汇总
    hexo+github搭建博客跳坑
    博客园主题样式修改
    wxss无法调用本地资源图片
    微信小程序wx:for循环
    Git常用命令总结
    git push解决办法: ! [remote rejected] master -> master (pre-receive hook declined)
  • 原文地址:https://www.cnblogs.com/utank/p/4077863.html
Copyright © 2011-2022 走看看