Articles for category: Data Structures and Algorithms

Breadth First Search Algorithm

The Breadth First Search Algorithm is a cornerstone technique in computer science, renowned for its efficiency in traversing and searching tree or graph data structures. By exploring all neighbours of a node before moving to the next level, the BFS Algorithm ensures a thorough and level-wise exploration, making it indispensable for various applications, from networking ...

Asymptotic Notations

Asymptotic notations in data structure are mathematical tools used to analyze the runtime of algorithms as input size grows. They enable comparison of algorithm efficiencies without manual runtime calculations, particularly beneficial for larger inputs. This article delves into different types of asymptotic notations and their application, excluding discussions on space complexity. Asymptotic notations offer crucial ...

Print Left View of Binary Tree

The left view of a binary tree corresponds to the nodes of the tree, which would be visible to someone seeing the tree from its left side, as shown in the image below – To print the left view of a binary tree, it’s essential to recognize that the leftmost node at each level is ...

What is Data Structures?

A data structure serves as a foundational framework for efficiently organizing and managing data within a computer system. It encompasses both the conceptual representation of data and its practical implementation in computer programs, ensuring that information can be accessed, manipulated, and utilized effectively. Why do we need to Learn Data Structures? Types of Data Structure ...

Disjoint Set

The Disjoint-Set data structure, also known as Union-Find, manages elements in non-overlapping subsets. It’s primarily used for graph connectivity problems, offering two operations: Union, to merge sets, and Find, to identify a set’s leader. This structure excels in tasks involving elements initially represented as separate sets, enabling efficient set combination and connectivity checks between elements. ...

Maximum Subarray Sum | Kadanes Algorithm

There is a well-known problem Maximum Subarray Sum, in which we have to find a contiguous subarray whose sum is maximum among all the subarrays for the given array. To solve this one must know about Kadane’s Algorithm. Kadane’s Algorithm is an iterative dynamic programming algorithm. Scope of Article This article gives detailed information about ...

Red Black Tree

Red-Black Trees are balanced binary search trees where nodes are colored red or black. This color scheme ensures O(log n) time complexity for search, insert, and delete operations. They self-balance, adapting to changes, making them efficient for managing large datasets. Simple rules govern their structure, ensuring fast searching, sorting, and data management. Properties of Red ...

Prim’s Algorithm

Prim’s Algorithm offers a strategic approach to constructing a minimum spanning tree from a given graph, ensuring every vertex is connected with the least total edge weight. This efficient method begins with a single vertex, expanding by selecting the lowest weight edges connecting to unvisited nodes, thus weaving a path that covers all without excess. ...

Manacher’s Algorithm

Manacher's algorithm is used to find the longest palindromic substring in any string. It is required to solve sub-problems of some very hard problems. The problem statement it solves is: Given a string 's' with the length of 'n'. Find the longest palindromic substring in the given string. A string is a palindrome when it ...

Johnson’s Algorithm for All-Pair Shortest Path

Johnson’s Algorithm is used to find all pair shortest path in a graph. We can use the Johnson’s Algorithm to find the shortest paths between all pairs of vertices in an edge-weighted directed graph. Johnson’s Algorithm uses both Dijkstra's Algorithm and Bellman-Ford Algorithm. Johnson’s Algorithm can find the all pair shortest path even in the ...