Simulation, Efficiency, and the Limits of Computing
Simulation and Undecidability
Part of: Algorithms, Iteration & Simulation
You now have the full toolkit, Booleans, conditionals, loops, traversals, and search. This lesson combines them into simulation and steps back to ask two big questions of Big Idea 3: how fast can a problem be solved, and are there problems no program can solve at all? Simulation: modeling a process step by step A simulation uses a program to imitate a real or hypothetical process, advancing it one step at a time inside a loop. Consider a walker on a number line who takes a series of steps left (L) or right (R): Each loop pass updates the state (pos) according to a rule. Real simulations model weather, traffic, populations, or games this way, track the state, apply the rules, repeat. When real processes are random, simulations use randomness; here we keep it deterministic so the result is exact. Efficiency: not all algorithms are equal The search lessons showed two algorithms for one job with wildly different costs, linear search does work proportional to n, binary search proportional to log n. Efficiency measures how an algorithm's work grows as the input grows. AP CSP describes an efficient algorithm as one that runs in a reasonable amount of time . Some problems have fast solutio
Challenge: Step Walk Final Position