Find Path

Find Path
Below is the code for solving the above problem:

Prims Algorithm

Like Kruskal’s algorithm, Prim’s algorithm is used for finding minimum spanning tree. The idea is to maintain two sets of vertices. The first set contains the vertices already included in the MST, the other set contains the vertices not yet included. At every step, it considers all the edges that connect the two sets, and ...

Kruskals Algorithm

Kruskals Algorithm
Kruskals algorithm is used for calculating minimum spanning tree. Minimum spanning tree is a spanning tree of a connected, undirected graph. It connects all the vertices together with the minimal total weighting for its edges. Approach for calculating the minimum spanning tree is described as below: 1. Sort all edges by their distance in non ...

Implementing hash function and using it into Own implemented HashMap

First what is a hash function? A hash function is a function which maps keys to indices of an array. So if k is the key and we have an array of size 10, then h(k) will be some integer value ranging between 0 to 9. So this means the hash function h maps the ...

Circular Queue implementation in Java using array. 3

Queue is an abstract data type which support below operation. new() – > for making new Queue. enqueue() – > insert element at rear. dequeue() – > remove an element from front. Supporting methods will be : size() isEmpty() isFull() Let’s start implementation of Queue via circular array. Below is the circular array: In queue ...