Input and output in file :

  For taking input and produce output from a file, at first we need to create 2 text file which mean the file extension must be .txt . The file have to create in the location in which we will save our java
source code.

Topological sort:

In computer science, a topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u comes before v in the ordering.
For example, in following  Directed graph , the first black vertex or in which vertex DFS find finish time should place in the last of the output. Here , DFS start traverse from Shirt, but first finished time is jacket .  So it goes to the last position of stack or link list.

Topological sort

Bubble sort algorithm implementation in java:

Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed,
which indicates that the list is sorted.

Breadth First Search:

Breadth First Search ( BFS ) is a searching algorithm which search the destination from root or source and explore all the neighbor nodes first, before moving to the next level neighbors. The animation will make this more clear.

To learn Breadth First Search ( BFS ) more deeply , you can download Breadth First Search in PowerPoint slide.
The following code is to implement Breadth First Search ( BFS ) in java

MARI themes

Powered by Blogger.