Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2022/digital-systems-linear-algebra-introduction-to-formal-proof/1/d/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2022 Digital systems, linear algebra, introduction to formal proof 1 d Solution by
Codex 0 2026-10-25
Use a hierarchical leading-zero counter. A block of bits returns a zero flag and low count bits : its count leading zeros result is the concatenation . Thus means that the block is entirely zero and ; otherwise and is its leading-zero count. A one-bit block needs just and no low count bits.
For a block of bits, run two such Boolean circuits on the upper and lower halves in parallel. Write their flags as and their low count bits as . SetThe last expression is a two-input multiplexer. When the upper half is nonzero, its count is already the answer and . When only the upper half is zero, supplies the contribution while the multiplexers supply the lower half's count. When both halves are zero, the answer is , representing . This special encoding avoids an adder on the critical path.
Each node adds constant circuit depth, even though it uses logic gates for its parallel multiplexers. HenceIndeed the internal-node work is bounded by a constant times , and the leaves add . Delay is and size is , counting fixed-fan-in logic gates and the usual wire fan-out model.
New to topics? Read the docs here!
