Skip to content

Instantly share code, notes, and snippets.

View mingliii's full-sized avatar
💭
I may be slow to respond.

Ming Li mingliii

💭
I may be slow to respond.
View GitHub Profile
@mingliii
mingliii / BFSDFS.java
Created April 13, 2017 11:04 — forked from gennad/BFSDFS.java
Breadth-first search and depth-first search Java implementation
Class Main {
public void bfs()
{
// BFS uses Queue data structure
Queue queue = new LinkedList();
queue.add(this.rootNode);
printNode(this.rootNode);
rootNode.visited = true;
while(!queue.isEmpty()) {
Node node = (Node)queue.remove();