Amortised Analysis · graine 1 · A4, économe en encre. Le corrigé s'imprime sur sa propre page, pour les adultes.
En anglais

Cheap usually, rare splurge, fair average

Informatique · Algorithmes et structures de données · de 19 à 21 ans
Nom ______________________   Date ____________
  1. When does a doubling array pay a big copy?

    • On every append
    • When items are read
    • Only when the array fills
  2. What does an amortised bound describe?

    • One lucky input
    • The average over any sequence
    • The cost of one line of code
  3. An amortised bound is an average-case claim about random inputs.

    En entourer un :   Vrai   Faux

  4. A resize copies 8 items. What pays for it?

    • The stored credits on those slots
    • A faster processor
    • Deleting other arrays
  5. Each cheap append stores 2 credits. After 4 such appends, type the stored credits.

    Réponse : ______________

  6. Why does a million appends cost a few million steps, not a million squared?

    • Copies thin out as the array grows
    • Appends skip writing entirely
    • Squares round down at scale
  7. With three coins per append, a hostile sequence can still break the constant average.

    En entourer un :   Vrai   Faux

  8. A critic points at one copying append and calls the structure linear per append. What is the flaw?

    • Copying appends never occur
    • One costly call cannot price a whole run
    • Arrays forbid all analysis
LightMySky · lightmysky.comW1-mt_1zLrl5RKGr-s1

Corrigé

Pour les adultes. Replier cette page avant de passer le reste.

Cheap usually, rare splurge, fair average W1-mt_1zLrl5RKGr-s1

  1. Only when the array fills · Full arrays copy into a doubled home.
  2. The average over any sequence · It averages a run, whatever the sequence.
  3. Faux · It is a worst-case promise over any sequence.
  4. The stored credits on those slots · Prepaid credits cover the copy run.
  5. 8 · Four appends times two credits makes eight.
  6. Copies thin out as the array grows · Doubling spaces the costly copies wider apart.
  7. Faux · The promise holds for any sequence.
  8. One costly call cannot price a whole run · Amortised pricing spreads rare costs across the run.