How to Count Islands in a Grid with DFS and BFS

Counting islands in a grid is a great exercise for learning graph traversal.