## Print nodes having maximum and minimum degrees

Given an undirected graph having N nodes, the task is to print the nodes having minimum and maximum degree. Examples: Input: 1—–2 | | 3—–4… Read More »

- Bellman Ford Algorithm (Simple Implementation)
- Introduction to Data Structures | 10 most commonly used Data Structures
- Lexicographically Smallest Topological Ordering
- Find the minimum number of moves to reach end of the array
- Print all neighbour nodes within distance K
- Shortest path from source to destination such that edge weights along path are alternatively increasing and decreasing
- Check which player visits more number of Nodes
- Pair with a given sum in BST | Set 2
- Minimum steps to color the tree with given colors
- Minimum number of pairs required to make two strings same
- Find the number of paths of length K in a directed graph
- Print the path between any two nodes of a tree | DFS
- Maximum number of nodes which can be reached from each node in a graph.
- Find the winner of the match | Multiple Queries
- Implementation of BFS using adjacency matrix
- Maximum number of edges in Bipartite graph
- Check if a cycle of length 3 exists or not in a graph that satisfy a given condition
- Find the maximum cost path from the bottom-left corner to the top-right corner
- Find K vertices in the graph which are connected to at least one of remaining vertices
- Find two disjoint good sets of vertices in a given graph
- Print nodes having maximum and minimum degrees
- Shortest cycle in an undirected unweighted graph
- Product of minimum edge weight between all pairs of a Tree
- Count the nodes of the given tree whose weighted string is a palindrome
- Find the root of the sub-tree whose weighted sum is minimum
- Arrange array elements such that last digit of an element is equal to first digit of the next element
- Count the nodes of the tree which make a pangram when concatenated with the sub-tree nodes
- XOR of all the nodes in the sub-tree of the given node
- Number of trees whose sum of degrees of all the vertices is L
- Convert Directed Graph into a Tree

Given an undirected graph having N nodes, the task is to print the nodes having minimum and maximum degree. Examples: Input: 1—–2 | | 3—–4… Read More »

It is highly recommended to read Dijkstra’s algorithm using the Priority Queue first. Widest Path Problem is a problem of finding a path between two… Read More »

Given an array arr[] of size N. There is an edge from i to arr[i]. The task is to convert this directed graph into tree… Read More »

Breadth First Search (BFS) has been discussed in this article which uses adjacency list for the graph representation. In this article, adjacency matrix will be… Read More »

Given an array arr[] of size N where every element is from the range [0, 9]. The task is to reach the last index of… Read More »

Given a sequence of non-negative integers arr[], the task is to check if there exists a simple graph corresponding to this degree sequence. Note that… Read More »

Given a graph of N nodes, E edges, a node X and a distance K. The task is to print all the nodes within the… Read More »

Given an array Arr of N integers representing the nodes of a graph. The edges are defined between those pair whose bitwise AND is not… Read More »

Given an undirected unweighted graph. The task is to find the length of the shortest cycle in the given graph. If no cycle exists print… Read More »

Given a tree with N nodes. Two players A and B start from node 1 and node N respectively. A can visit all the adjacent… Read More »

Given a tree of distinct nodes N with N-1 edges and a pair of nodes P. The task is to find and print the path… Read More »

Given a tree with N vertices and N-1 Edges. Let’s define a function F(a, b) which is equal to the minimum edge weight in the… Read More »

Given a two dimensional grid, each cell of which contains integer cost which represents a cost to traverse through that cell. The task is to… Read More »

We have learnt about Generic class in Java. We can also use them to code for Graph in Java. The Graph Class is implemented using… Read More »

Given an array of pairs arr of size N which represents a game situation where the first player wins against the second player. Given multiple… Read More »