Similarities and differences between deep search and breadth search

Source: Internet
Author: User

Same:

1. Both methods are blind searches, which are feasible only when the search space is smaller than the computer memory.

2. Both methods include the open set and the closed set. The open set is used to store the nodes to be accessed, and the closed set stores the accessed nodes.

Point.

3. The average time complexity of the two methods is O (B ^ d), where B is the branch factor and D is the search depth.

4. Both methods involve checking whether a node has been accessed in the closed set, and adopting different data structures for the closed set.

Storage has different performance. linear search requires O (n) time complexity, while hash search requires constant time complexity.

Differences:

1. Obviously, the search strategy is different. One is depth, and the other is breadth ^-^. We all know that ~

2. Stack is used for deep priority search to store open sets. Adding and deleting operations only require constant time, while extended priority search requires teams.

Column to store the open set. Adding and deleting operations only require constant time.

3. In Deep Priority Search, only B * D state nodes need to be stored on the stack. For the breadth-first search, status nodes B ^ d are stored. So the two search methods

The storage scale is different.

4. Multiple paths in the target State can be found in the depth-first search. In the breadth-first search, the shortest path in the target State is found.

Note: If the search result is a tree, the deep search is equivalent to the first root traversal, and the extended search is equivalent to the first root traversal.

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.