Breadth First Search (BFS) Algorithm
The Lee Algorithm is a breadth-first search (BFS) algorithm that is used to find the shortest path between two points in a grid-like structure, such as a maze. It is an unweighted grid-based algorithm, meaning that all cells in the grid have the same traversal cost, and it finds the shortest path …
Bellman-Ford Algorithm
The Bellman-Ford algorithm is a dynamic programming algorithm that computes the shortest paths from a single source vertex to all other vertices in a weighted graph. It is particularly useful for graphs that contain negative weight edges, which Dijkstra’s algorithm cannot handle. Key Characteristics…
Disjoint Set Union (DSU)
Union-Find, also known as the Disjoint Set Union (DSU), is a data structure that is used to manage a collection of disjoint (non-overlapping) sets. It supports two primary operations: Find: Determine the set to which a particular element belongs. Union: Merge two sets into a single set. The Union-Find…
Floyd-Warshall Algorithm
The Floyd-Warshall algorithm is a dynamic programming algorithm used to find the shortest paths between all pairs of vertices in a weighted graph. Unlike other algorithms such as Dijkstra’s, which computes the shortest path from a single source to all other vertices, the Floyd-Warshall algorithm co…
Kruskal's Algorithm
Kruskal's Algorithm is a greedy algorithm used to find the Minimum Spanning Tree (MST) of a graph. A spanning tree is a subset of the edges that connects all vertices in a graph without any cycles. The minimum spanning tree is the spanning tree with the least total edge weight. Key Concepts: Und…
Huffman Algorithm
Huffman Coding is a popular algorithm used for lossless data compression. It generates variable-length codes based on the frequency of characters or symbols. The more frequently occurring symbols are assigned shorter codes, while less frequent ones get longer codes, reducing the total number of bit…
Depth-First Search (DFS)
Depth-First Search (DFS) is a fundamental graph traversal algorithm that explores as far along a branch as possible before backtracking. It dives deep into the graph, visiting vertices along a path until it reaches a vertex with no unvisited neighbors, and then it backtracks to explore other paths.…
Breadth-First Search (BFS)
Breadth-First Search (BFS) is an algorithm used to explore nodes and edges in a graph. It systematically explores the vertices in layers, expanding each vertex's neighbors before moving on to the next layer. BFS is particularly useful for finding the shortest path in an unweighted graph or for …
Dijkstra's Algorithm
Dijkstra's Algorithm is a popular algorithm used to find the shortest path from a source vertex to all other vertices in a weighted graph. It works by exploring the graph and expanding the nearest unvisited node (with the smallest tentative distance) at each step, ensuring that the shortest pat…
Quick Sort
Quick Sort is another efficient sorting algorithm that follows the divide and conquer strategy. It works by selecting a "pivot" element from the array and partitioning the other elements into two sub-arrays: those less than the pivot and those greater than the pivot. The sub-arrays are th…
Merge Sort
Merge Sort is a popular and efficient sorting algorithm that follows the divide and conquer paradigm. It works by recursively dividing the array into two halves, sorting each half, and then merging the sorted halves back together. The merging process ensures that the final array is sorted. Steps: Div…
Bubble Sort
Bubble sort is based on the idea of repeatedly comparing pairs of adjacent elements and then swapping their positions if they exist in the wrong order. In pseudo-code, this would look like: counter <-- 0 swaps <-- 1 length <-- LEN(list)# this gives the number of elements in the array WHILE swap…
Binary Search
Binary search is a more complex algorithm than linear search and requires all items to be in order/ sort The algorithm runs as follows: Sort the list item and than start by setting the counter to the middle position in the list. If the value held there is a match, the search ends. If the value at the mid…
Linear Search
T his is a simple algorithm used to find a value in a list of data . The algorithm runs as follows: Identify a search term. Look at the first item in the list. Compare the item with the search term. Is the current item the same as the search term? If so, the item has been found. If not, move to the next i…
Core Algorithms
Core algorithms are fundamental techniques used in computer science and software development to solve a wide variety of problems efficiently. These algorithms form the building blocks of many applications, systems, and technologies. Below is an overview of some key core algorithms categorized by th…