Skip to content

Instantly share code, notes, and snippets.

View triplel's full-sized avatar

Liliang Li triplel

  • Placeiq
  • New York
View GitHub Profile
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();