Sources

Script Algorithmen und Datenstrukturen – Einleitung (HS 2026, Kap. 1–3) and Prof. Püschel’s lecture recordings (Part 1 and the start of Part 3). The script has no numbered definitions or lemmas yet, so these notes follow its section numbers (1.1, 1.2, 2, 3). Places where the lecture and script disagree, or the transcript is garbled, are marked with ⚠ Discrepancy.


1. Executive Overview & Core Objectives

This first week introduces the algorithmic way of thinking (algorithmische Denkweise) through two toy problems: the Pasture-Break problem (a short-sighted cow searching for a gap in a fence) and Star Search (finding a person known by everyone who knows no one). The method is the same in both. First write down a simple, correct algorithm, then count its cost in the worst case (schlechtester Fall), then ask “Geht es besser?” and improve it. Along the way the lecture introduces mathematical induction (vollständige Induktion) as a proof tool, and shows that the same idea, reducing size to size , is also a design tool for algorithms (an inductive algorithm). Recurrences that arise from such algorithms are solved by telescoping (Teleskopieren), which gives a guess, and then by induction, which proves it.

Learning objectives. After this week you should be able to:

  • State what an algorithm is (complete description, elementary operations, solves a problem for all instances).
  • Explain why we analyse the worst case and not the best case.
  • Analyse both Pasture-Break strategies (step size gives , doubling gives ), including the choice of with .
  • Write a full induction proof (base case, induction hypothesis, induction step), including proofs whose base case is not , and inequality proofs such as Bernoulli’s inequality.
  • Set up a recurrence for a recursive algorithm, guess its closed form by telescoping, and prove it by induction.
  • Give the naive (), recursive ( worst case) and improved () star-search algorithms, with correctness arguments and question counts.
  • Name the factors that make real runtimes machine-dependent, and explain why we need abstract models (RAM model, asymptotic analysis).

2. Core Concepts & Formal Definitions

2.1 Algorithms (Script §1.1)

Definition (Algorithm / Algorithmus) – lecture version

An algorithm (Algorithmus) is a complete description (vollständige Beschreibung) of a sequence of elementary operations (Abfolge von elementaren Operationen) that solves a problem (Problem).

Definition (Algorithm) – script version

Informally, an algorithm is a systematic decomposition (systematische Zerlegung) of an apparently difficult problem into simple steps. “Systematic” means the decomposition generalises: it is not tailored to one instance of the problem. So we require a description of the step sequence that is

  • unambiguous (eindeutig),
  • complete (vollständig), and
  • generally valid (allgemeingültig), meaning it works for every instance.

Key components:

  • Complete (vollständig): nothing is left out. The description is detailed enough that it is clear exactly what happens.
  • Elementary operations (elementare Operationen): the allowed atomic steps. Which steps count as elementary depends on the problem and the model. Examples: one step of the cow; one question “does know ?”; for a computer, the basic machine instructions.
  • Problem specification: problems are usually stated as “Given (gegeben) …, find (gesucht) …”.

Everyday examples from the lecture: cooking and baking recipes, IKEA assembly instructions (numbered, pictorial elementary steps), and written addition or multiplication from school. The script uses written multiplication as its main example: it reduces multi-digit multiplication to single-digit multiplications and additions, and the same description works for every pair of numbers.

Algorithms in computer science. We care about algorithms that operate on data and are executed by computers. Computers:

  • can run arbitrary algorithms on data,
  • very fast: about operations per second (lecture; already true for a smartphone), “billions of steps per second” (script),
  • and provide many elementary operations in which we express algorithms.

The script’s motivation: being able to process huge amounts of data is what makes things like large language models possible. Faster hardware alone is a fallacy (Trugschluss). A good algorithm can process a data set in minutes on a laptop, while a bad one would not finish on the world’s fastest supercomputer before the sun burns out. With a better algorithm we can process the same data faster, or more data in the same time. Computer science is often defined as the science of algorithms.

Goals of the course (A&D):

  1. Design and analysis of algorithms (Entwurf und Analyse von Algorithmen): learn the recurring ideas behind algorithm design, and learn to analyse cost.
  2. Data structures (Datenstrukturen): discussed later.
  3. The algorithmic way of thinking (algorithmische Denkweise): analogous to the mathematical way of thinking. It uses mathematical methods for analysis but is not the same thing as mathematics.
  4. Knowing important algorithms (e.g. sorting). These are already implemented, but the point is to understand how they were designed, their advantages and disadvantages, and how to analyse them.

Typical questions in the algorithmic way of thinking (script):

  • Which different algorithms exist for the same problem?
  • How can we compare them? Can we assign a quality measure and quantify how much better one is?
  • Can we determine the best possible algorithm with respect to this measure?

2.2 Worst-Case Analysis

Definition (Worst case / Best case)

For a fixed problem size (e.g. distance , number of persons ), the worst case (schlechtester Fall) of an algorithm is the maximum cost over all admissible inputs or situations of that size. The best case (bester Fall) is the minimum.

Why worst case?

The worst case gives a guarantee: whatever the input, the cost never exceeds this bound. The best case is meaningless as a quality measure because it is rare. Average-case analysis exists but is (almost) never used in this course. Püschel: “Uns interessiert immer der Worst Case.”

2.3 Pasture-Break Problem (Script §1.2)

Problem (Pasture Break / "Ausbruch aus der Weide")

Given: an infinite, straight fence; a short-sighted (kurzsichtig) cow standing next to it; exactly one gap (Lücke) in the fence at distance steps, either to the left or to the right of the cow. The cow does not know the direction and, in general, does not know .
Elementary operation: one step parallel to the fence. At each position the cow can only see whether the gap is exactly there.
Goal: find the gap with as few steps as possible in the worst case, for every .

Assumptions (from student questions):

  • The fence is infinite, so can be arbitrarily large, but is a fixed finite number.
  • The cow stops as soon as it reaches position on the correct side.
  • The algorithm must work for all . Assumptions such as "" or “the gap is on the left” would allow better special-case algorithms, but they are not allowed.

2.4 Mathematical Induction (Script Kap. 2)

Definition (Principle of mathematical induction / vollständige Induktion)

Let be a statement depending on . To prove for all it suffices to show:

  1. Base case (Induktionsanfang, IA): holds.
  2. Induction step (Induktionsschritt, IS), : for all : if holds, then holds.

Equivalently: show with the help of . The assumption ” holds” used inside the step is the induction hypothesis (Induktionshypothese, IH).

Generalisation: if the base case is at (show , and the step for all ), then holds for all .

Intuition: domino chain

IA gives . IS with gives ; with it gives , and so on. An infinite family of statements is proved by a finite argument (two finite proofs). The IS must cover all , otherwise the chain breaks.

Why proofs at all (script)? Testing an algorithm on many inputs says nothing about the other inputs, and small changes in the input can have drastic effects. We want statements for all inputs, and only proofs give those.

Definition (Recurrence / Rekurrenz)

A recurrence (Rekurrenz) is an equation that defines through values of at smaller arguments, together with one or more base cases (Basisfälle). Example: , for .
Recurrences arise naturally when an algorithm reduces a problem of size to size : cost() = cost() + cost of the reduction. A recurrence determines uniquely but does not show directly how big is. For that we want a closed form (geschlossene Formel) such as .

Method (Telescoping / Teleskopieren, as used in this lecture)

Substitute the recurrence into itself repeatedly () until a pattern appears, then extrapolate down to the base case. The resulting "" argument is not a proof. It produces a conjecture, which is then proved by induction.

⚠ Terminology note: in this lecture “Teleskopieren” means repeated substitution / unrolling. Other texts use “telescoping sum” for . The two are related (unrolling produces exactly such a sum), but don’t let the name confuse you.

Knowledge types (Püschel's mental model)

  • Look-up knowledge: you know where to look it up (Google, an LLM).
  • Middle-of-the-night knowledge: someone wakes you at 3 a.m. and you know it instantly. These two sums must be in this category:

2.5 Star Search (Script Kap. 3)

Definition (Star)

In a group of persons , a person is a star (Star) if

  1. knows no other person: for all , does not know , and
  2. every other person knows : for all , knows .

(Knowing oneself is irrelevant.) Mental model: Tom Cruise (lecture) or Roger Federer (script) walks into the lecture hall.

Problem (Star search / Starsuche)

Given: persons . Find: the star if one exists, otherwise report “no star”.
Elementary operation: a yes/no question “Does know ?”, written .
Goal: as few questions as possible in the worst case.

Lemma (number of stars)

A group has either 0 or 1 stars. Both cases occur.

  • 0 stars is possible (in fact the normal case for large groups, e.g. this lecture hall).
  • 1 star is possible (bring Tom Cruise in).
  • 2 or more stars is impossible.

2.6 Comparing Algorithms (preview, finished next lecture)

Criteria for judging algorithms:

  • Correctness (Korrektheit): strictly, this requires a formal proof. So far we have only argued informally.
  • Runtime (Laufzeit): always the worst case, as a guarantee.

The difficulty is that real runtime depends on

  • the input (its size, and whether it is “nice” or not),
  • the computer (speeds differ and have grown enormously over the decades),
  • the implementation: programming language (Python vs. C vs. Rust), compiler, and how cleverly it is written.

A statement like “runs in seconds on this machine” is useless: too detailed, and different for every machine and implementation. We need models that abstract from these details and are therefore universally valid:

  1. Unit-time random-access model (RAM model): a processor plus memory, with simplified assumptions about what each operation (e.g. loading data) costs.
  2. Asymptotic runtime analysis (asymptotische Laufzeitanalyse): only linear (), quadratic (), and so on. Constant factors ( vs. ) change from machine to machine. The growth type does not. On any computer and in any language, a linear algorithm beats a quadratic one for large enough .

3. Step-by-Step Derivations & Mathematical Proofs

3.1 Pasture Break, distance known

Algorithm: walk steps in one direction (say left). If the gap is not there, walk back () and then to the right.

CaseSteps
gap on the left
gap on the right

Worst case . Nothing can be improved here: without knowing the direction, the cow must risk the wrong side first.

3.2 Pasture Break, unknown: Algorithm 1 (increase by 1)

Idea: zig-zag. You must alternate sides, because betting on one side forever may never find the gap. Increase the distance each time: left and back, right and back, left and back, …

It terminates: at the latest in round , the cow walks distance on the correct side.

Worst-case scenario. The last round on the correct side just misses: it reaches distance on the gap side, turns back (). Then it walks on the wrong side and back (). Then it walks on the correct side and finds the gap.

Whether lands on the gap side depends on the parity of (since sides alternate). If round goes to the wrong side, round already goes to the correct side and the two “useless” ‘s disappear. That is the better case.

Counting:

Why stop at and not : the cow sees the gap at distance and stops.

For comparison, the good parity case: , which differs by exactly from the worst case.

Verdict: dominant term . For , about steps. Very expensive.

Why is it wasteful? In round the cow walks steps, but the first positions on that side were already inspected two rounds earlier. Each round adds only 1–2 new positions, while the cost per round keeps growing. Effort is out of proportion to the information gained.

3.3 Pasture Break: Algorithm 2 (doubling)

Idea: double the distance each round, so each round explores about as many new positions as were already known: left and back, right and back, left and back, right and back, …

Choice of . Pick the unique with

i.e. is the first power of two (). This is unique for every , because the intervals partition the positive integers.

Worst-case scenario. The cow just misses: the round of length goes to the correct side and falls short, since . Back . Then the round of length , which would have succeeded, goes to the wrong side: there and back. Then the round of length goes to the correct side and stops after steps.

(Lecture Q&A: “Is the near-miss of length ?” It misses too, but is the maximal near-miss. That is the unlucky case, because if were on the wrong side, the next round of length would hit.)

Counting:

using the sum of the first powers of two, (proved in §3.4).

⚠ Discrepancy (transcript): the spoken sum reads “2·1 + 2·1 + 2·2 + …”. This is a transcription or speech slip. The correct sum is , as in the script.

Bounding in terms of (abschätzen). We want an upper bound that is a function of alone.

  • From : . This is the key trick: write as to connect it to .
  • Dropping the only makes the expression larger (fine for an upper bound).

Worst case , i.e. linear in . For : at most about steps instead of about . For (script): Algorithm 1 needs more than steps, Algorithm 2 fewer than .

Theorem (optimality of 9k, stated without proof)

The bound is best possible: for every algorithm and every there is a for which the algorithm needs at least steps in the worst case.
In particular, tripling, using factor 1.5, and so on do not improve the worst case. Faster growth makes it worse (see Self-Assessment Q1).

⚠ Lecture vs. script: the lecture only says “it can be proven that other factors don’t improve the worst case; we won’t do it”. The script gives the precise lower bound, also without proof.

On "Geht es besser?"

Showing that something can be done better is easy: exhibit a better algorithm. Proving that nothing can be better (a lower bound, untere Schranke) is in general very hard. For many problems it is unknown whether the best known algorithm is optimal.

3.4 Induction Example 1: sum of powers of two

Claim

Let . Then for all :

How to find the conjecture (script): , , , . Each is one less than the next power of two.

Proof by induction on .

IA (): (a single summand) and . ✓

IS (): assume (IH). Then

This is exactly the claim for .

Why split off the last term? Because that exposes , the object the IH talks about. This is the standard first move in induction proofs about sums.

⚠ Discrepancy: in the recording Püschel first wrote the sum incorrectly, then said after the break “da hatte ich vorhin einen Fehler drin” and fixed it. The version above (and in the script) is correct.

3.5 Induction Example 2: Bernoulli’s inequality (Bernoullische Ungleichung)

Theorem (Bernoulli's inequality)

For all and all :

(Named after the Swiss mathematician Jakob Bernoulli, 17th century.) Formally, induct on with : ” for all ”.

IA (): , so "" holds (with equality). ✓

IS (): strategy. Start from the left-hand side for and use only "" and "" steps until appears, using the IH somewhere along the way.

The two delicate points:

  1. Multiplying an inequality by a number is only allowed if that number is non-negative, otherwise the inequality flips. We multiply by . This is exactly where is used.
  2. Dropping is allowed because it is (as and ) and we only want "".

Exam Trap: use every hypothesis

At the end of a proof, check that you have used every assumption. If a hypothesis (here ) was never used, you have probably overlooked something.

⚠ Transcript garble: the expansion was transcribed as “1 plus x plus x plus nx Quadrat”. The correct expansion is .

3.6 Induction Example 3: a simple recurrence (base case )

Claim

Let and for . Then for all .

The function is defined only from on: is given directly, and the recurrence gives all larger values. So the claim starts at , and the base case is . There is no statement for .

IA (): . ✓

IS (, ): assume . Since , the recurrence applies:

Writing the result in the form makes it visible that it matches the claim for .

⚠ Script typo: the last line in the script reads "". The parentheses are misplaced. Correct: .

3.7 Telescoping to find the closed form

Suppose we did not already know the answer . Unroll the recurrence (valid for all ):

Pattern: subtracting in the argument adds twos. To reach the base case we take :

The "" is not a proof, so the induction of §3.6 then nails it down.

3.8 Star Search: naive algorithm

Algorithm: ask every about every (). Then all “knows” relations are known, and we can check the star definition directly.

Count: an table without the diagonal (no one is asked about themselves):

This is quadratic. For about 300 people in the hall, roughly questions (the lecture says “about 100,000”).

3.9 Star Search: recursive / inductive algorithm (first attempt)

Design idea (inductive algorithm, induktiver Algorithmus): solve the problem for persons, given the solution for persons. This is induction used not as a proof but as an algorithm construction method: build the size- solution from the size- solution, just like an induction step.

Base case : ask both possible questions ( and ), so 2 questions. There is a star iff exactly one of the two knows the other.

For :

  • Step 0: send one person out of the room, w.l.o.g. .

  • Step 1 (recursion): find the star among .

  • Step 2: if step 1 returned a star , test whether is a star among all by asking

    • (must be no), and
    • (must be yes).

    If both are as required, is the star (there is at most one). Done.

  • Step 3: reached if step 1 found no star or step 2 failed. Then the only possible candidate is . Test it with, for all (i.e. ):

    • (must be no), and
    • (must be yes).

    If all succeed, is the star; otherwise there is no star.

Lemma (why only remains a candidate)

If with is a star among , then is also a star among .
Proof: both star conditions only become weaker when persons are removed. “Everyone knows ” and ” knows nobody” still hold for the subset.
Contrapositive (Püschel: “Wenn ich kein Star bin unter wenig Personen, dann bin ich auch kein Star unter vielen”): if the recursive call finds no star, or its star fails in step 2, then no with can be the star of the full group. Only is left.

Analysis. Let be the number of questions.

Best case (step 2 always succeeds, step 3 never runs):

This is exactly the recurrence from §3.6, already solved. Example for the best case (script): a chain where is the star of every prefix group, e.g. everyone knows and knows nobody.

Worst case (step 3 is needed in every recursive call): this happens if the person sent out is always the star of the current group. Step 3 costs questions.

Subtle detail (lecture): if we reach step 3 after step 2 failed, the two questions between and were already asked, so step 3 needs only new questions. Then step 2 + step 3 costs . If step 1 found no star, step 3 alone costs . Either way the step adds .

Telescoping:

⚠ Transcript garble: the spoken version of this telescoped line (“2 mal n minus 1, … bis 2 mal 2 plus 2 mal 2 plus 2 mal 3 …”) is muddled. The correct sum is shown above and matches the script’s table, .

Verdict: , no better than the naive algorithm. The recursive idea by itself does not help. You only find out by analysing it.

3.10 Star Search: improved algorithm ()

Diagnosis: the expensive part is step 3, which happens because the person sent out might be the star.

Idea: make sure never to send out a star in step 0. Then step 3 is never needed: if the recursive call finds no star, there is none (the removed person is not a star either), and if step 2 fails, there is none.

How, with one question? Pick two persons and ask :

  • Answer yes: knows someone, so is not a star.
  • Answer no: is not known by , so is not a star.

Either way, one question identifies a guaranteed non-star. That person is sent out.

Key asymmetry

Proving that someone is not a star is cheap (one question). Proving that someone is a star is expensive (all questions).

Script formulation of the new step 0:

0. If knows , swap and .

Correctness: if the original is a star, then knows it and they are swapped. The new (the old ) knows someone, so it is not a star. If they are swapped, the person now called is the old , who knows the old and is therefore not a star. If not swapped, does not know , so is not a star. In every case the new is not a star and can be sent out.

StarSearch(P_1, ..., P_n):                  // returns the star or NONE
    if n == 2:
        ask P_1 -> P_2 and P_2 -> P_1
        if  P_1 knows P_2 and not (P_2 knows P_1): return P_2
        if  P_2 knows P_1 and not (P_1 knows P_2): return P_1
        return NONE
    // Step 0: guarantee P_n is not a star (1 question)
    if P_{n-1} knows P_n:
        swap(P_{n-1}, P_n)
    // Step 1: recursion on the first n-1 persons
    s := StarSearch(P_1, ..., P_{n-1})
    if s == NONE: return NONE              // P_n is not a star either
    // Step 2: verify s against P_n (2 questions)
    if not (s knows P_n) and (P_n knows s):
        return s
    return NONE                            // no Step 3 needed

Analysis (worst case): per recursion level at most (step 0) (step 2) questions.

Worst case = step 2 is always executed, i.e. step 1 always returns a star. If it returns “no star”, we stop early.

Telescoping:

Induction proof of for : IA: ✓. IS: ✓.

Result

The improved inductive star search needs at most questions in the worst case. “At most”, because some questions may repeat: step 0 may ask the same pair as a later step 2. This is linear: for about 300 people, under 900 questions (lecture: “about 1000”) instead of about 90,000.

Meta-lesson

The only design idea that went in was the inductive one: build the solution for from the solution for . The algorithm follows almost mechanically from it. Analysis shows whether it is good. Here a second iteration (“which person should we remove?”) was needed to make it efficient.


4. Worked Examples & Applications

Example: naive star search,

Question table (rows: who is asked; columns: about whom; ”–” = not asked):

–yesyes
no–no
noyes–

questions. Who is the star? Column is all “yes” (everyone knows ), and row is all “no” ( knows nobody). So is the star.
(Lecture: a student first suggested , reading the table the wrong way round. A star must be known (its column is all “yes”) and must not know anyone (its row is all “no”). knows others, so it is not a star.)

Example: improved star search,

Relations: , , , ; nobody else knows anyone.

  • , step 0: does know ? No, so is not a star and is sent out. (1 question)
  • on , step 0: does know ? No, so is sent out. (1)
  • on : yes, no, so the star is . (2)
  • Back at , step 2: ? no ✓. ? yes ✓. So is the star of . (2)
  • Back at , step 2: ? no ✓. ? yes ✓. is the star. (2)

Total: . ✓

Exam Trap: "early termination" does not fix the worst case

A student proposed: “as soon as knows someone, stop asking .” Püschel first accepted this, then corrected himself at the start of Part 3:

  1. Knowing is not a star does not make irrelevant. Any other can only be a star if knows , so we still need to answer questions about others.
  2. More generally, special-case shortcuts (“in this situation I can save something”) do not improve the worst case. Improvements must hold in every case.

Exam Trap: elementary operations must stay elementary

“Ask each person how many others they know” is not one elementary operation. It hides elementary questions. Always count in the agreed elementary operation.

Exam Trap: off-by-one in the worst-case picture

In Pasture Break the worst case is the maximal near-miss: (Algorithm 1) or (Algorithm 2) on the correct side, followed by a full useless sweep on the wrong side. Choosing , or forgetting the return trips, gives wrong counts.

Exam Trap: base case when the statement starts at

If a claim is only defined for , the base case is , not . In the step, make sure the recurrence is actually applicable: needs , which holds for all .

Exam Trap: inequalities in induction

Multiplying both sides of an inequality by a negative number flips it. In Bernoulli the hypothesis exists precisely to guarantee . Without it the statement can fail: , gives .

Student questions from the lecture (answered):

  • Is the fence finite? No, it is infinite, so can be arbitrarily large, but it is a fixed number.
  • Why stop at and not continue to ? The cow sees the gap at distance and leaves.
  • Can’t we exploit assumptions like ""? No. Solutions must work for all .
  • Does tripling help in Pasture Break? Not in the worst case (it gets worse, see Q1).
  • Is the recursive star algorithm more efficient? “We don’t know yet; we only know after analysing it.” (It turned out not to be, until step 0 was improved.)
  • Lower-bound thought: every person must be involved in at least one question, so one can hope for something linear but not better. (This is only a heuristic. No formal lower bound was proved.)

5. Intuition & Conceptual Bridges

Intuition: doubling = balance effort and information

Algorithm 1 pays an ever-growing cost per round for a constant amount of new information (1–2 new positions). Doubling makes the new region in each round about as big as everything explored before. The total work is then a geometric series, dominated by its last term, so the cost is proportional to the final distance and therefore . Geometric growth (doubling) will come back often: dynamic arrays, exponential search, and similar.

Intuition: induction as proof and as design

  • As proof: plus () gives for all .
  • As design: “solve size 1 or 2 directly” plus “turn a size- solution into a size- solution” gives an algorithm for every .
  • As analysis: this design automatically produces a recurrence (cost() = cost() + cost of the step). Telescoping guesses its solution; induction proves it.
    The same structure appears three times, which is why Püschel stresses the “deep connection” between induction and certain algorithms, both in analysis and in construction.

Intuition: why the step cost decides everything

For we get .

  • constant step cost → linear total (, ),
  • linear step cost → quadratic total ().
    So in an inductive algorithm the whole game is to make the step from to cheap. That is exactly what the improved step 0 does: it turns a step into a step.

Connections:

  • Backward: Gauss’s sum was on exercise sheet 0. The geometric sum is the binary number .
  • Forward: next lecture covers the RAM model and asymptotic analysis (O-notation), i.e. formalising “linear beats quadratic for large , constants don’t matter”. Exercise sheets 0 and 1 prepare the mathematics. Later in the course come recursion and divide-and-conquer (recurrences of the form ), sorting algorithms, correctness proofs (e.g. invariants), and data structures.

6. Summary & Self-Assessment Questions

Cheat Table

TopicKey fact
Algorithmcomplete, unambiguous, generally valid description of a sequence of elementary operations solving a problem
Analysis focusworst case (a guarantee), never best case
Pasture break, knownworst case (optimal)
Pasture break, step worst case
Pasture break, doubling; worst case
Optimality is best possible: lower bound (no proof given)
Gauss sum
Geometric sum
InductionIA: ; IS: for all ; IH = assumption
Bernoulli for ,
Telescopingunroll the recurrence, spot the pattern, then prove by induction
,
Starknows nobody, known by everybody; at most one star
Naive star search questions
Recursive (send out )best , worst
Improved (send out a non-star)worst
Non-star in 1 question: yes means is not a star; no means is not a star
Runtime depends oninput, machine, implementation (language, compiler)
AbstractionRAM model plus asymptotic analysis (linear vs. quadratic, ignore constants)

Self-Assessment Questions

Question 1. Instead of doubling, the cow multiplies its distance by each round (, alternating sides). Derive the worst-case number of steps as a function of and compare with . Then generalise to an arbitrary factor .

Question 2. Prove by induction that for all .

Question 3. Let and for . Guess a closed form by telescoping and prove it by induction.

Question 4. (a) Why is the first recursive star-search algorithm (always sending out ) quadratic in the worst case? Describe a worst-case instance. (b) Explain precisely why, after the improved step 0, step 3 is never needed.

Question 5. In the proof of Bernoulli’s inequality, identify exactly where the hypothesis is used, and show by a concrete example that the inequality can fail without some lower bound on .