ProgrammingModerate

A 2D grid of 2000 x 2000 cells is searched by a BFS that visits each cell once. About how many cell visits happen?

  1. A. About 4 x 10^9
  2. B. About 2000
  3. C. About 8 x 10^3
  4. D. About 4 x 10^6

Correct answer: D. About 4 x 10^6

Each of the 4 x 10^6 cells is visited a constant number of times, so the work is about 4 x 10^6.

More C Programming questions

Exams that ask this topic