-
1. The concept of stack backtracking:
Stack backtracking is the backtracking method, which is a search algorithm that is both systematic and jumpy. It searches the solution space tree from the root node in the solution space tree containing all the solutions of the problem according to the depth-first strategy. When the algorithm searches for any node in the solution space tree, it always first determines whether the node definitely does not contain the solution of the problem.
If it is definitely not included, the systematic search of the subtree with the node as the root is skipped, and the layer by layer backtracks to its ancestral node. Otherwise, go to the subtree and continue searching by depth-first policy. When the backtracking method is used to find all the solutions to the problem, it is necessary to go back to the root, and all the subtrees of the root node have been searched before it ends.
The backtracking method is used to find any solution to the problem, and it can be ended as long as one solution of the problem is searched. This algorithm that systematically searches for solutions to problems in a depth-first manner is called backtracking, and it is suitable for solving some number of combinations.
Bigger questions.
2. Algorithm framework:
1. The solution space of the problem: When applying the retrospective method to solve the problem, the solution space of the problem should be clearly defined. The solution space of the problem should contain at least one (optimal) solution of the problem.
2. The basic idea of the retrospective method: to determine the organizational structure of the understanding space.
After that, the backtracking method starts from the start node (root node) and searches the entire solution space in a depth-first manner. This starting node becomes a living node, and at the same time becomes the current extension node. At the current extended node, the search moves to a new node in the direction of depth.
This new node becomes a new live node and becomes the current expansion node. If you can no longer move in depth at the current expansion node, the current expansion node becomes a dead node. In other words, this node is no longer a slip knot.
At this point, you should move back (backtrack) to the nearest slipknot and make this slipknot the current extended node. The backtracking method works in this way to recursively search in the solution space until the desired solution is found or when there are no loose knots in the solution space.
Retrospectively solving a problem usually involves the following three steps:
1) Define the solution space of the problem according to the given problem;
-
Personally, I feel like you can think differently or something.
If the key is for me, I will try it with ce first...
CE (cheatengine) is used to debug games, and it is easy to find data such as pointers.
-
Of course, the big difference is that the C language is an English sentence. And easy language Chinese programming is simple and easy to learn.
-
It seems that the address I found is the same as the tutorial, but exitprocess doesn't know how to return to the program's airspace for backtracking.
-
#include
#include
int judge(int *p, int j) to determine whether the current position of the piece is in accordance with the rules, if it is a good order, it returns 1, otherwise it slides back to 0;
int i;
for(i=0;iif(p[j]==p[i]) return 0;
if(abs(p[j]-p[i])=j-i) return 0;
return 1;
int main()
int a[8];a[i] indicates the position after row i (a[3]=0 means that the queen in row 3 is in column 0).
int i=0,j=0,k=0;
for(a[0]=0;a[0]<8;j=0,a[j]++for(a[++j]=0;a[j]<8;j=1,a[j]++if(judge(a,j))
for(a[++j]=0;a[j]<8;j=2,a[j]++if(judge(a,j))
for(a[++j]=0;a[j]<8;j=3,a[j]++if(judge(a,j))
for(a[++j]=0;a[j]<8;j=4,a[j]++if(judge(a,j))
for(a[++j]=0;a[j]<8;j=5,a[j]++if(judge(a,j))
for(a[++j]=0;a[j]<8;j=6,a[j]++if(judge(a,j))
for(a[++j]=0;a[j]<8;a[j]++if(judge(a,j))
for(i=0;i. "Quarrel 8; i++)printf("%d",a[i]);
printf("%3s","
if(!(k%7)) printf("");
printf("There are a total of %d solutions",k);
return 0;
-
Stack. Bilingual.
Dictionary Result: Web Paraphrasing.
1.Stack traceback.
-
stack-traceback; stacking backtracking; Stack trace information.
-
That's a strange question.
The value in the register, either you use the push instruction to enter the stack, or when you call call and int, the program will automatically put the current CS and IP values into the stack, and in other cases it will not automatically enter the stack.
Add si,2 Is it true to write like this? Of course, there is no problem in writing it this way.
Since B comes out of the stack first, the stack starts as follows. ba >>>More
The art of drama has the following basic characteristics:
1) Theatricality. >>>More
Enthusiasts use their imagination to create extras with characters and plots from anime. >>>More
It is a feeling to like someone, but it is a fact that you don't like someone; Facts are easy to explain, but feelings are hard to put into words. The difference between loving someone and liking someone is: your heart beats faster when you stand in front of the person you love; But when you stand in front of someone you like, you only feel happy. >>>More
It's not a card building, it's a tower.
In layman's terms, small high-rise buildings are towers, and multi-storey buildings are slab buildings. >>>More