Skip to content

Tag Archives: graph-cycle

Given an undirected graph, the task is to check whether it has a cycle or not, and if it has a cycle return the vertices… Read More
Given an undirected graph with N nodes and two vertices S & T, the task is to check if a cycle between these two vertices… Read More
Floyd’s cycle finding algorithm or Hare-Tortoise algorithm is a pointer algorithm that uses only two pointers, moving through the sequence at different speeds. This algorithm… Read More
Given an undirected graph with N nodes and two vertices S & T, the task is to check if a cycle between these two vertices… Read More
Given a directed graph of N vertices valued from 0 to N – 1 and array graph[] of size K represents the Adjacency List of… Read More
Given a group of N people, each having a unique ID value from 0 to (N – 1) and an array arr[] of M elements… Read More
Given an undirected Graph consisting of N nodes in the form of an adjacency matrix graph[][] of size N*N, the task is to print all… Read More
Given an array arr[] consisting of N strings representing the name of the students in the class and another array of pairs P[][2] such that… Read More
Given an array arr[] consisting of N distinct positive integers, the task is to find the minimum number of elements required to be swapped to… Read More
Given an undirected graph consisting of N vertices and M edges and an array edges[][], with each row representing two vertices connected by an edge,… Read More
Given N nodes valued by [1, N], an array arr[] consisting of N positive integers such that the ith node ( 1-based indexing ) has… Read More
Given an array arr[] consisting of first N natural numbers, construct an undirected graph using the array elements such that for any array element, connect… Read More
Given an undirected graph with N vertices and N edges that contain only one cycle, and an array arr[] of size N, where arr[i] denotes… Read More
Given a directed graph G N nodes and E Edges consisting of nodes valued [0, N – 1] and a 2D array Edges[][2] of type… Read More
Given a graph G consisting of nodes valued [0, N – 1], a source S, and an array Edges[][3] of type {u, v, w} that… Read More

Start Your Coding Journey Now!