Skip to main content

5 docs tagged with "search-algorithms"

View all tags

Binary Search

Binary search is a highly efficient searching algorithm used to find the position of a target value within a sorted array. This algorithm operates on the divide and conquer principle, which significantly reduces the time complexity compared to linear search methods.

Breadth-first search (BFS)

Breadth-first search (BFS) is a widely used algorithm for traversing or searching tree and graph data structures. It starts at a selected node (often referred to as the 'root' in the context of trees), and explores all of the neighbor nodes at the present depth prior to moving on to nodes at the next depth level. This characteristic allows BFS to provide the shortest path to a target node in an unweighted graph, which is one of its most significant advantages.

Depth-First Search (DFS)

Depth-First Search (DFS) is a fundamental algorithm used in graph theory to traverse or search through the nodes of a graph in a systematic manner. DFS explores as deep as possible along each branch before backtracking, making it an efficient algorithm for tasks that need to explore all the nodes in a graph thoroughly.

Linear Search

Linear search, also known as sequential search, is a fundamental algorithm used to find a specific element within a list. It operates by starting at the beginning of the list and examining each element one by one until the target element is found or the end of the list is reached. This method is straightforward and does not require the list to be sorted, but it can be inefficient for large datasets.

Search Algorithms

Search algorithms are essential for locating elements within various data structures such as arrays, linked lists, trees, and graphs. These can be broadly categorized into two types based on their implementation approaches: