Pseudocode vocabulary

  • ← (arrow) — assignment; for each item in list — iteration; while cond — loop
  • Base case — the stop condition in recursion (e.g., if n = 0: return 1)
  • Recursive case — the function calls itself with a smaller input
  • Running maximum/minimum/sum — a variable that accumulates across iterations
  • DFS = "visit node, then recursively visit neighbors"; BFS = "visit all neighbors first (queue)"

Question 0 of 5

Read this pseudocode and choose the best plain-English description:

function findMax(list):
  max ← list[0]
  for each item in list:
    if item > max:
      max ← item
  return max