Arithmetic Series

Context: FIT1008_MOC, FIT1058_MOC, FIT2004_MOC · the sum of an arithmetic sequence · the counting tool behind nested-loop Time Complexity FIT2004 use: the behind shrink-by-one recurrences () and behind sorted insertions into a BST.

Quick Revision

  • 🎯 Objective: sum a constant-difference sequence ➔ (average of first and last term).
  • 📦 Core Components: general ➔ the case.
  • ⚡ Key Constraint: ➔ why a “shrinking” nested loop is quadratic, not linear.

📝 Core

1. The Series (Constant Difference)

  • General sum ➔ from first term , terms: .
  • Algorithm-analysis case.
  • Gauss pairing, over pairs.

2. Reverse-and-Add (FIT1058)

  • Method ➔ write forwards and backwards, aligned ➔ every column sums to .
  • Result.
  • Dominant term linear, quadratic ➔ sign of decides .

3. Which Series a Loop Generates

  • Arithmetic ➔ nested loops whose inner count shrinks by one.
  • Geometric Binary Tree node counts, height.

⚖️ Core Decision Matrix

SumClosed formOrder
(Geometric Series)

When It Flips: the constant and lower-order drop under Big-O Notation, leaving — but the exact closed form is needed for tight constants or off-by-one correctness.

📊 Exam Execution Trace

Manual Execution Trace

Counting a shrinking nested loop, :

Step / StateOuter passInner iterationsRunning total
0 (Init)0
1144
2237
3329
441

⚠️ Common Mistakes

  • 💡 Shrinking inner count is still ➔ not ; a sum of terms each averaging is quadratic.

✍️ Practice

🧠 Active Recall