PROBLEM DESCRIPTION Trie is an efficient information retrieval data structure. This data structure is used to store Strings and search strings, String stored can also be deleted. Given a Trie root...
Insert and Search in a Trie (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Complete the Insert and Search functions for a Trie Data Structure. Insert: Accepts the Trie’s root and a string, modifies the root in-place, and returns nothing. Search:...
Strongly Connected Components (Kosaraju's Algo) (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a Directed Graph with V vertices (Numbered from 0 to V-1) and E edges, Find the number of strongly connected components in the graph. geeksforgeeks SOLUTION Good Expla...
Dijkstra Algorithm (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a weighted, undirected and connected graph of V vertices and an adjacency list adj where adj[i] is a list of lists containing two integers where the first integer of each...
Find the number of islands (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a grid of size n*m (n is the number of rows and m is the number of columns in the grid) consisting of ‘0’s (Water) and ‘1’s(Land). Find the number of islands. Note: An i...
Topological sort (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given an adjacency list for a Directed Acyclic Graph (DAG) where adj_list[i] contains a list of all vertices j such that there is a directed edge from vertex i to vertex j, wit...
Directed Graph Cycle (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a Directed Graph with V vertices (Numbered from 0 to V-1) and E edges, check whether it contains any cycle or not. geeksforgeeks SOLUTION APPROACH 1 - USING DFS (STACK...
Maximize The Cut Segments (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given an integer n denoting the Length of a line segment. You need to cut the line segment in such a way that the cut length of a line segment each time is either x , y or z. H...
Undirected Graph Cycle (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given an undirected graph with V vertices labelled from 0 to V-1 and E edges, check whether it contains any cycle or not. Graph is in the form of adjacency list where adj[i] co...
DFS of Graph (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION You are given a connected undirected graph. Perform a Depth First Traversal of the graph. geeksforgeeks SOLUTION To implement DFS, we use a recursive helper function that ex...