# Category Archives: Data Structures

Weakly Connected Graph: A directed graph ‘G = (V, E)’ is weakly connected if the underlying undirected graph Ĝ is connected.  The underlying undirected graph… Read More
Priority queue is a data structure in which data is stored on basis of its priority. In an Indexed Priority Queue, data is stored just… Read More
An array is a collection of items stored at contiguous memory locations. It is to store multiple items of the same type together. This makes… Read More
Given a 2D array Edges[][], representing a directed edge between the pair of nodes in a Directed Acyclic Connected Graph consisting of N nodes valued… Read More
Given an array arr[] consisting of N positive integers, the task is to replace each array element with the nearest power of GCD of all… Read More
There are many data structures like arrays, linked lists, etc. Each sort of arrangement has its strengths and weaknesses. For these reasons, it’s important to… Read More
Given a Binary Tree, the task is to remove the leaf nodes of the Binary Tree during each operation and print the count. Examples: Input:  … Read More
Given two integers X and Y, the task is to find the two integers having sum X and Bitwise XOR equal to Y. Examples: Input:… Read More
A linear search or sequential search is a method for finding an element within a list. It sequentially checks each element of the list until… Read More
A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list… Read More
Given an Undirected Connected Graph in the form of a tree consisting of N nodes and (N – 1) edges, the task for each edge… Read More
Given a Binary Tree, the task is to count all paths from root to leaf which forms an Arithmetic Progression. Examples:  Input:   Output: 2 Explanation: The paths… Read More
Given an undirected non-weighted graph G. For a given node start return the shortest path that is the number of edges from start to all… Read More
Given an array A[] of N integers, the task is to generate an array B[] such that B[i] contains the count of indices j in… Read More