Samual Sam has Published 2310 Articles

Ford Fulkerson Algorithm

Samual Sam

Samual Sam

Updated on 16-Jun-2020 14:01:32

4K+ Views

The Ford-Fulkerson algorithm is used to detect maximum flow from start vertex to sink vertex in a given graph. In this graph, every edge has the capacity. Two vertices are provided named Source and Sink. The source vertex has all outward edge, no inward edge, and the sink will have ... Read More

Box Stacking Problem

Samual Sam

Samual Sam

Updated on 16-Jun-2020 13:33:48

1K+ Views

In this problem a set of different boxes are given, the length, breadth, and width may differ for different boxes. Our task is to find a stack of these boxes, whose height is as much as possible. We can rotate any box as we wish. But there is a rule ... Read More

Eulerian Path and Circuit

Samual Sam

Samual Sam

Updated on 16-Jun-2020 13:20:51

8K+ Views

The Euler path is a path, by which we can visit every edge exactly once. We can use the same vertices for multiple times. The Euler Circuit is a special type of Euler path. When the starting vertex of the Euler path is also connected with the ending vertex of ... Read More

Longest Path in a Directed Acyclic Graph

Samual Sam

Samual Sam

Updated on 16-Jun-2020 12:46:03

2K+ Views

One weighted directed acyclic graph is given. Another source vertex is also provided. Now we have to find the longest distance from the starting node to all other vertices, in the graph.We need to sort the nodes in topological sorting technique, and the result after the topological sort is stored ... Read More

Shortest path with exactly k Edges

Samual Sam

Samual Sam

Updated on 16-Jun-2020 12:34:11

625 Views

One directed graph is provided with the weight between each pair of vertices, and two vertices u and v are also provided. Our task is to find the shortest distance from vertex u to vertex v, with exactly k number of edges. To solve this problem, we will start from vertex ... Read More

Connectivity in a directed graph

Samual Sam

Samual Sam

Updated on 16-Jun-2020 11:35:48

3K+ Views

To check connectivity of a graph, we will try to traverse all nodes using any traversal algorithm. After completing the traversal, if there is any node, which is not visited, then the graph is not connected.For the directed graph, we will start traversing from all nodes to check connectivity. Sometimes ... Read More

Detect Cycle in a an Undirected Graph

Samual Sam

Samual Sam

Updated on 16-Jun-2020 11:27:25

8K+ Views

To detect if there is any cycle in the undirected graph or not, we will use the DFS traversal for the given graph. For every visited vertex v, when we have found any adjacent vertex u, such that u is already visited, and u is not the parent of vertex ... Read More

How to switch data from an array to array list in java?

Samual Sam

Samual Sam

Updated on 16-Jun-2020 11:14:27

300 Views

The Arrays class of the java.util package provides you a method named asList(). This method accepts an array (of objects) and converts them into a list and returns it.ExampleLive Demoimport java.util.Arrays; import java.util.List; public class ArrayToList {    public static void main(String args[]) {       Integer[] myArray ... Read More

Bridges in a Graph

Samual Sam

Samual Sam

Updated on 16-Jun-2020 10:48:32

2K+ Views

An edge in an undirected graph is said to be a bridge, if and only if by removing it, disconnects the graph, or make different components of the graph. In a practical approach, if some bridges are present in a network when the connection of bridges is broken, it can break ... Read More

The Knight’s tour problem

Samual Sam

Samual Sam

Updated on 16-Jun-2020 09:51:09

4K+ Views

In chess, we know that the knight can jump in a special manner. It can move either two squares horizontally and one square vertically or two squares vertically and one square horizontally in each direction, So the complete movement looks like English letter ‘L’.In this problem, there is an empty ... Read More

Advertisements