Skip to main content
Module 4 · Manhattan Navigation

Lesson 4 · The Manhattan Algorithm — Knowledge Checks

Name Date
  1. Why can't the robot use a straight diagonal to shorten the trip?

    1. A.Diagonals are slower than straight lines
    2. B.The robot follows grid lines, so it can only move along rows and columns
    3. C.The grid is too small
    4. D.It can — the Manhattan algorithm just chooses not to

    Answer Why?

  2. Hand-tracing (2,0) → (2,3), what path do you get?

    1. A.[(2,0), (2,1), (2,2), (2,3)]
    2. B.[(2,1), (2,2), (2,3)]
    3. C.[(2,3)]
    4. D.[]

    Answer Why?

  3. Why does the stage-1 function return [] for (3,3) → (1,0)?

    1. A.append() is broken
    2. B.Both while conditions are False from the start (3 is not < 1, 3 is not < 0), so neither loop runs
    3. C.The start and end are the same
    4. D.It runs forever

    Answer Why?

  4. For a trip that goes up and to the right, how many of the four while loops actually run?

    1. A.All four
    2. B.Two — the north loop and the east loop
    3. C.Just one
    4. D.None — it needs if/else

    Answer Why?

  5. What does compute_path((2, 2), (2, 2)) return, and why?

    1. A.[(2, 2)] — the current position
    2. B.[] — all four loop conditions are False, so nothing is appended
    3. C.An error
    4. D.0

    Answer Why?