Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Graph

Breadth First Search (BFS)

  • Use the queue data structure to hold each vertex that needs to be visited in the future.
  • It should keep a visited data structure to store all the visited vertices.
  • Runtime: O(V+E) / V = vertices | E = edges.

Depth First Search (DFS)

  • Use the stack data structure or do recursive.
  • It should keep a visited data structure to store all the visited vertices.
  • Runtime: O(V+E) / V = vertices | E = edges.