What is Search Algorithm

In computer science, a search algorithm is an algorithm designed to solve a search problem. Search algorithms work to retrieve information stored within particular data structure, or calculated in the search space of a problem domain, with either discrete or continuous values.

State Space & States

A Set of States

Basically as what it means. We use {T} to represent it.

T₀ Initial State

Tₙ Goal State

Production System

General Database

A Data Structure.

i.e. set, array, tree, queue, stack

Production Rule

Basically rules to obey when operating the database

※ Usually as in If Clauses

Control System

Breadth-first Search

Breadth-first search (BFS) is an algorithm for searching a tree data structure for a node that satisfies a given property. It starts at the tree root and explores all nodes at the present depth prior to moving on to the nodes at the next depth level. Extra memory, usually a queue, is needed to keep track of the child nodes that were encountered but not yet explored.

Untitled

※ Best for Connect Nodes & Max/Min Value Problem. You can use flags to mark possibilities and use queue to store data.

Depth-first Search

Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible along each branch before backtracking. Extra memory, usually a stack, is needed to keep track of the nodes discovered so far along a specified branch which helps in backtracking of the graph.

Untitled