New algorithm: count the number of connect components in an 2D grid without Depth First Search