MindMap Gallery Design and Analysis of Algorithms
Mind maps of algorithm design and analysis, such as exam reminders for algorithm design: The main points should be grasped in the description of the idea. It can be explained step by step, and the process can be explained with examples. It should not be too simple; Relevant variables and data structures are clearly described; Library functions can be called directly; Pseudocode generally appears in the form of functions, with necessary comments added; Read the question requirements clearly and don’t miss any questions.
Edited at 2023-06-04 20:17:08One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
Project management is the process of applying specialized knowledge, skills, tools, and methods to project activities so that the project can achieve or exceed the set needs and expectations within the constraints of limited resources. This diagram provides a comprehensive overview of the 8 components of the project management process and can be used as a generic template for direct application.
One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
Project management is the process of applying specialized knowledge, skills, tools, and methods to project activities so that the project can achieve or exceed the set needs and expectations within the constraints of limited resources. This diagram provides a comprehensive overview of the 8 components of the project management process and can be used as a generic template for direct application.
Design and Analysis of Algorithms
Algorithm evaluation
Five characteristics of algorithms
certainty
feasibility
Finiteness
There are 0 or more inputs
There is more than 1 output
Five Principles of Algorithm Analysis
correctness
simplicity
Optimality
time complexity
space complexity
Definition of algorithm
An algorithm is a sequence of finite rules
Time complexity analysis method
Analytical Methods for Non-Recursive Algorithms
Counting the number of basic operations performed by an algorithm (counting method)
average time complexity
Determine basic operations
Analyze how many types of inputs there are and determine the probability of occurrence of each (type) input
Analyze the number of basic operations performed by each input
Create expressions about n according to relevant formulas
Simplify the function to get a relatively simple result
Expressed in asymptotic notation (get the highest order term, ignore coefficients and low-order terms)
Worst time complexity
Determine basic operations
Analyze the worst-case scenario of the input
Calculate the number of times a basic operation is performed under worst-case input
simplify function
Expressed in asymptotic notation (get the highest order term, ignore coefficients and low-order terms)
Analytical Methods for Recursive Algorithms
Create a recurrence equation
Solving recurrence equations
Iterative method
direct iteration
substitution iteration
difference iteration
recursive tree
First, the expression of the recursive equation is divided into recursive terms and free terms. The recursive terms need to be further solved recursively. The free terms are some functional expressions or constant terms about n.
Use the free term of the initial equation as the root node and the recursive term as the leaf node to build a tree.
Replace the leaf node with the subtree composed of the equation expression corresponding to the current leaf node until all nodes in the tree are composed of free terms
Add the free terms of each node to get the final result
main theorem
NP complete theory
3 basic computing models
random access machine RAM
Random Access Stored Programmer RASP
Turing MachineTM
Computable problems (easy to solve problems)
Problems solvable in polynomial time
Uncomputable problems (difficult problems)
There is no problem with polynomial time algorithms
P type questions
Judgment problems solvable in polynomial time
NP type problem
Verifiable decision problems in polynomial time
NPC issues
The NPC problem is an NP problem. All NP problems can be reduced to this problem in polynomial time. Such a problem is an NPC problem.
NP-hard problem
This problem is not necessarily an NP problem, but all NP problems can be reduced to this problem in polynomial time.
recursion
The concept of recursion
Recursion is a method that calls itself directly or indirectly in its definition
Two basic elements of recursion
recursive exit
recursive body
Time complexity analysis method of recursive algorithm
Create a recurrence equation
Solving recurrence equations
Iterative method
direct iteration
substitution iteration
difference iteration
recursive tree
First, the expression of the recursive equation is divided into recursive terms and free terms. The recursive terms need to be further solved recursively. The free terms are some functional expressions or constant terms about n.
Use the free term of the initial equation as the root node and the recursive term as the leaf node to build a tree.
Replace the leaf node with the subtree composed of the equation expression corresponding to the current leaf node until all nodes in the tree are composed of free terms
Add the free terms of each node to get the final result
main theorem
No typical examples
You can look at the homework questions and understand what the code you wrote means.
divide and conquer
The basic idea of divide and conquer
Divide a large problem that is difficult to solve into smaller problems of the same type so that they can be solved individually and divided and conquered
Divide and conquer problem solving steps
Decomposition: Divide the original problem into a series of sub-problems
Solution: Solve each sub-problem recursively. If the subproblem is small enough, it can be solved directly
Merge: combine the results of subproblems into the solution of the original problem
The key to problem solving can be done using divide and conquer
The solutions to the sub-problems decomposed for the problem can be combined into the solution of the problem
Analysis method of time complexity of divide and conquer method
Build and solve recursive equations
Read the summary of book P101
The balancing principle of divide-and-conquer design
Make the subproblems roughly the same size
The core of divide and conquer
Decompose the problem into smaller sub-problems of the same nature
No typical examples
dynamic programming
The essence of dynamic programming: divide and conquer thinking and solving redundancy
Two important properties of dynamic programming
Optimal substructure properties
The optimal solution to a problem includes the optimal solutions to its subproblems
Overlapping sub-problem properties
The sub-problems that a problem depends on are not always new problems, some sub-problems will appear multiple times
Dynamic programming problem solving steps
Find the properties of the optimal solution and characterize its structural characteristics
Recursively define optimal values (build dynamic transfer equations)
Calculate the optimal value in a bottom-up manner
Construct the optimal solution based on the information obtained when calculating the optimal value
Key points in the description of dynamic programming algorithm ideas
Establish dynamic transfer equations and explain their meaning
Dynamic programming complexity analysis method
Time complexity: analyze the number of nested loops and the number of loops
Space complexity: depends on the size of the table
Typical examples
Fibonacci Sequence
digital triangle problem
0-1 backpack problem
Matrix multiplication problem
longest common subsequence
longest non-increasing subsequence
Maximum sum of consecutive fields
greedy
Two properties of the greedy method to solve problems
Optimal substructure properties
The optimal solution to a problem includes the optimal solutions to its subproblems
greedy choice property
The optimal solution to the problem can be obtained through a series of local optimal solutions
Key points of the description of the idea of greedy algorithm
Determine the greedy selection strategy and describe the specific process
Greedy method time complexity analysis method
Do you need to sort?
The complexity of the process depends on the specific problem
Typical examples
Event arrangement issues
River crossing problem
Huffman coding
minimum spanning tree
Backtrack
Problem-solving characteristics of backtracking method
Dynamically generate the solution space of the problem during the search process
Design elements of the backtracking method
solution vector
solution space tree
depth first search
pruning function
Problem-solving steps of backtracking method
For the given problem, define the solution space of the problem
Identify easily searchable solution space problem structures
Search the solution space in a depth-first manner, and use pruning functions to avoid invalid searches during the search process
Key points in the description of the backtracking method
Given the solution space, determine whether it is a subset tree or a permutation tree, and design a pruning function
Backtracking time complexity analysis method
Depends on whether it is a subset tree or a permutation tree
Typical examples
0-1 backpack problem
Traveling Salesperson (TSP) Problem
symbolic triangle problem
Remember the code framework of the permutation number and subset tree on the ppt
Key review ideas
branch and bound
The basic idea/solution goal of branch and bound
P265 Summary
Two ways to implement branch and bound
queued branch bounds
Priority queue branch bounding
Probabilistic algorithm
Sherwood algorithm
Las Vegas Algorithm
Monte Carlo algorithm
Characteristics and differences of the three algorithms
Similarities and Differences of Special Algorithms
Similarities and Differences between Branch and Bound and Backtracking
The similarities and differences between dynamic programming and greedy
Similarities and Differences between Divide and Conquer and Dynamic Programming
Precautions
The time complexity of the algorithm design part considers the worst time complexity
About after-school homework questions
The model is similar to the typical example. The same goes for the exam, there won’t be original questions, but the model may be the same.
The exam questions did not specify time complexity analysis, but said that complexity analysis
Both time complexity and space complexity need to be analyzed
Take a closer look at the answers to the questions in the first exam paper given by the teacher. There are common mistakes in them.
Exam reminder
algorithm design
The main points should be grasped in the description of the idea. It can be explained step by step, and the process can be explained with examples. It should not be too simple.
Relevant variables and data structures are clearly described
Library functions can be called directly
Pseudocode generally appears in the form of functions, with necessary comments added.
Read the question requirements clearly and don’t miss any questions
Analysis of Algorithms
Analysis requires a calculation process, not just results.