Skip to content
  • Overview
  • Curriculum
    • FLUMental maths and numerical fluency
    • COMBCounting and combinatorics
    • PROBProbability
    • GAMEGames, decision theory and puzzles
    • MMMarket making
    • MKTMarkets and products

Practise

  • Question bank
  • Mental arithmetic
  • Market simulator
  • Arbitrage trees
  • Horse racing
  • Bid book
  • Screening tests
  • Mock papers

Reference

  • Formula reference
  • Search

Your record

  • Review queue
  • Progress
  • Leaderboard
  • Profile
  • Invite friends
AccountSend feedback
  1. Formulas

Data structures and algorithms

The master theorem

Solves the divide-and-conquer recurrences that turn up in every algorithms interview.

T(n)=a T ⁣(nb)+f(n) ⇒ compare f(n) with nlog⁡baT(n) = a\,T\!\left(\tfrac{n}{b}\right) + f(n) \ \Rightarrow\ \text{compare } f(n) \text{ with } n^{\log_b a}T(n)=aT(bn​)+f(n) ⇒ compare f(n) with nlogb​a

Where

f(n)=Θ(nlog⁡ba)f(n) = \Theta(n^{\log_b a})f(n)=Θ(nlogb​a)
The tied case: multiply by log⁡n\log nlogn.
a=b=2, f=Θ(n)a = b = 2,\ f = \Theta(n)a=b=2, f=Θ(n)
Merge sort: Θ(nlog⁡n)\Theta(n\log n)Θ(nlogn).

Assumptions

  • Regularity conditions apply in the unbalanced cases; the tied case is the one that turns up.

Sanity check. Binary search is a=1a = 1a=1, b=2b = 2b=2, f=Θ(1)f = \Theta(1)f=Θ(1), giving Θ(log⁡n)\Theta(\log n)Θ(logn).

Where this is taught

  • Complexity: reading it off, and deriving it · CS · Complexity

QuantMax · 141 lessons · 1342 questions · c5c0caa

  • Premium
  • Arbitrage trees
  • Horse racing
  • Invite friends
  • Account
  • About QuantMax
  • Terms
  • Privacy

Firm names identify publicly reported question patterns and nothing more. QuantMax is not affiliated with, endorsed by, or recruiting for any firm named in the curriculum. Everything you do in lessons and the question bank is kept to your account.