MindMap Gallery Five commonly used algorithms
A summary of five commonly used algorithms: divide and conquer algorithm, dynamic programming algorithm, greedy algorithm, branch and bound method, and backtracking method.
Edited at 2021-03-28 23:38:27Avatar 3 centers on the Sully family, showcasing the internal rift caused by the sacrifice of their eldest son, and their alliance with other tribes on Pandora against the external conflict of the Ashbringers, who adhere to the philosophy of fire and are allied with humans. It explores the grand themes of family, faith, and survival.
This article discusses the Easter eggs and homages in Zootopia 2 that you may have discovered. The main content includes: character and archetype Easter eggs, cinematic universe crossover Easter eggs, animal ecology and behavior references, symbol and metaphor Easter eggs, social satire and brand allusions, and emotional storylines and sequel foreshadowing.
[Zootopia Character Relationship Chart] The idealistic rabbit police officer Judy and the cynical fox conman Nick form a charmingly contrasting duo, rising from street hustlers to become Zootopia police officers!
Avatar 3 centers on the Sully family, showcasing the internal rift caused by the sacrifice of their eldest son, and their alliance with other tribes on Pandora against the external conflict of the Ashbringers, who adhere to the philosophy of fire and are allied with humans. It explores the grand themes of family, faith, and survival.
This article discusses the Easter eggs and homages in Zootopia 2 that you may have discovered. The main content includes: character and archetype Easter eggs, cinematic universe crossover Easter eggs, animal ecology and behavior references, symbol and metaphor Easter eggs, social satire and brand allusions, and emotional storylines and sequel foreshadowing.
[Zootopia Character Relationship Chart] The idealistic rabbit police officer Judy and the cynical fox conman Nick form a charmingly contrasting duo, rising from street hustlers to become Zootopia police officers!
Five commonly used algorithms
divide and conquer algorithm
recursion
Basic idea
Decompose a large problem that is difficult to solve into several smaller sub-problems, divide and conquer them, and then merge them to obtain the solution to the original problem
Applicable situations
① Can be decomposed into several smaller-scale identical problems
② Reducing the scale to a certain extent can make it easier to solve
③The solutions to each sub-problem can be combined into the solution to the original problem
④Each sub-problem is independent of each other
The basic steps
Decomposition: Decompose the original problem into several smaller, independent sub-problems with the same form as the original problem.
Solution: If the sub-problem is small and easy to solve, solve it directly, otherwise solve each sub-problem recursively.
Merge: merge the solutions of each sub-problem into the solution of the original problem
application
binary search
Quick sort
merge sort
chessboard overlay
Tower of Hanoi
dynamic programming algorithm
Recursion
Basic idea
Divide the original problem into sub-problems in several stages, solve the local optimal solution of each stage in order, and provide relevant information for the next stage. When the optimal solution of the final stage is found, it is the solution of the original problem.
Every decision will cause a state transition and is solved during dynamic changes, so it is called "dynamic programming"
Applicable situations
①Satisfies the optimization principle: If the optimal solution of a problem contains solutions to sub-problems that are also optimal, the problem is said to have optimal substructure, that is, it satisfies the optimization principle.
②No aftereffect: subsequent decisions will not affect the previous state
③ There are overlapping sub-problems: The sub-problems are not independent, and a sub-problem may be used multiple times in subsequent decisions.
The basic steps
Divide the stages:
According to the time or space characteristics of the problem, the problem is divided into several stages. (The divided stages must be ordered or sortable)
Determine the state and state variables:
The state in which the problem is developed into each stage is represented by appropriate state variables. (State selection must satisfy no aftereffects)
Determine the decision and write the state transition equation:
Determine decisions based on the relationship between the states of two adjacent stages, and write the state transition equation.
Find boundary conditions:
The state transition equation is a recursive formula that requires termination conditions or boundary conditions for the recursion.
Three elements
问题的阶段
每个阶段的状态
递推关系
application
Fibonacci sequence
0/1Backpack Problem
Backtracking
depth first strategy
Basic idea
That is, the depth-first strategy. Go down a road. If this road is blocked, go back to the previous fork and choose another road to continue walking until all paths are traversed.
application
depth first search
Binary tree preorder traversal
Eight Queens Problem
maze problem
branch and bound method
breadth first strategy
Basic idea
That is the breadth first strategy. Layer-wise expansion checks all nodes until the final result is found.
application
breadth first search
Dijkstra finds the shortest path
prim algorithm
greedy algorithm
Easy to implement and efficient in most cases
Basic idea
When solving problems, always make the best choice at the moment. There is no guarantee of global optimality, but it may be better.
Applicable situations
no aftereffects
The best local optimal strategy can lead to the global optimal solution
application
Dijkstra finds the shortest path
prim algorithm
Kruskal algorithm
traveling salesman problem