Embercode
✕
Stacks and QueuesQuick quiz

Stack growth and multi-source BFS

8 questions. Covers Multi-source BFS on grids.

Questions 1 to 5 of 8

  1. 1. A stack built on an array that doubles its capacity, starting from empty, gets 1000 pushes. How many items does it copy in total?

    Type a number.

  2. 2. A stack whose capacity grows by one slot each time it is full, starting from empty, gets 10000 pushes. How many items does it copy in total?

    Type a number.

  3. 3. Why does doubling make a push cost constant time on average, even though one push can copy every item?
  4. 4. In multi-source BFS, why are all the start cells put into the queue before the loop begins?
  5. 5. In minutesToRot, the number of cells to process in a minute is read once at the start of that minute. What goes wrong if it is read again on every step of the inner loop?

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.