- Python Data Structures and Algorithms
- Benjamin Baka
- 218字
- 2021-07-09 19:45:06
Algorithm design paradigms
In general, we can discern three broad approaches to algorithm design. They are:
- Divide and conquer
- Greedy algorithms
- Dynamic programming
As the name suggests, the divide and conquer paradigm involves breaking a problem into smaller sub problems, and then in some way combining the results to obtain a global solution. This is a very common and natural problem solving technique, and is, arguably, the most commonly used approach to algorithm design.
Greedy algorithms often involve optimization and combinatorial problems; the classic example is applying it to the traveling salesperson problem, where a greedy approach always chooses the closest destination first. This shortest path strategy involves finding the best solution to a local problem in the hope that this will lead to a global solution.
The dynamic programming approach is useful when our sub problems overlap. This is different from divide and conquer. Rather than break our problem into independent sub problems, with dynamic programming, intermediate results are cached and can be used in subsequent operations. Like divide and conquer it uses recursion; however, dynamic programming allows us to compare results at different stages. This can have a performance advantage over divide and conquer for some problems because it is often quicker to retrieve a previously calculated result from memory rather than having to recalculate it.
- Learning Spring 5.0
- JavaScript語言精髓與編程實踐(第3版)
- Mastering Ubuntu Server
- 假如C語言是我發明的:講給孩子聽的大師編程課
- 深入淺出Serverless:技術原理與應用實踐
- RISC-V體系結構編程與實踐(第2版)
- Haskell Data Analysis Cookbook
- Instant Lucene.NET
- 運維前線:一線運維專家的運維方法、技巧與實踐
- FFmpeg開發實戰:從零基礎到短視頻上線
- R Data Science Essentials
- Distributed Computing in Java 9
- OpenCV 3計算機視覺:Python語言實現(原書第2版)
- Python預測之美:數據分析與算法實戰(雙色)
- 小學生C++趣味編程從入門到精通