The small difference between wide search and deep search

Source: Internet
Author: User
The small difference between wide search and deep search

generally, the wide search is often used to find a single shortest route, or small-scale path search, it is characterized by "search is the best solution", and deep search for multiple solutions or "step number known (like 3 steps to be necessary to achieve the premise)" title, its space efficiency is high, but found not necessarily the optimal solution, Must be recorded and completed the full search, so in general, deep search needs to be very efficient pruning (optimization).

like the shortest path to search these are significant if the use of wide search, because the characteristics of the wide search is a layer down the search, to ensure that the current search is the optimal solution, of course, the shortest path is only one side of the operation, like what the minimum state conversion can also be manipulated.
Deep Search is a priority to search for a subtrees tree, and then another tree, it and the broad search, there is a relatively small memory needs of the Director, eight Queen title is a model of the operation, this kind of title is obviously can not use wide search to solve. Or, like the graph theory inside the algorithm of the circle, the number of pre-order sequence of sequential traversal, etc., are deep search

The difference between deep search and wide searching is the difference in the order of searches.

the implementation of the deep search is approximate to the stack, and each time the top element of the stack is selected to enlarge,

wide search is the operation of the queue, the first enlarged node priority to expand.

the shape of the search tree: A lot of deep search layer, wide search is very wide.

Deep Search to find all the solutions, wide search is used to find the best solution

deep Search and wide-search differences:

Deep Search does not guarantee that the first touch of the policy point is the shortest path, is to search all possible paths, is to backtrack, logo memento sign done after the disappearance, is a unified point may be visited many times. and wide search because of its from near node enlargement order, the node is always the shortest path to be visited. If a node is visited for the second time, the second path is determined not to be shorter than the first, so that there is no need to expand from this node to the surrounding area-the first visit to this node has expanded, and the second expansion will only get a worse solution. It is the logo that has been made, memento sign does not have to go missing. It is possible to be interviewed at most once by a single point. Each visit to a node, the side connected to it is examined once. In the worst case, all sides are examined once, with a time complexity of O (E).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.