Complexity smell cards
Recall common complexity smells and the data-structure response they suggest.
Objection It is only a small list right now. A scan-inside-loop appears in a path that will receive customer data. Approving by today's test size ignores tomorrow's n. Your line Small today is fine, but let's name the growth shape and the expected production size before we keep the scan. It keeps the conversation empirical and ties Big-O to a real forecast. Pattern Repeated scan versus indexed lookup Use the indexed version when key lookup is the repeated operation. What question reveals an accidental quadratic loop? Ask whether the same collection is scanned inside a loop over another collection. If…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in