O(n) -- Linear Time
An O(n) algorithm does work that grows in direct proportion to the input size. If processing one million rows takes one second, processing two million takes about two seconds. The relationship is a straight line on a graph, which is why it is called linear time. Linear algorithms are the workhorses of data engineering. Full table scans, aggregations, pandas vectorized operations, and single-pass transformations are all O(n). For many tasks, O(n) is the best you can possibly do, because you need to look at every row at least once. Why it matters: a table scan checks every row one at a time. The more rows you add, the more work the database must do, because it cannot skip anything it has not checked yet. Single-Pass Processing The most common O(n) pattern in data engineering is iterating thr
About This Interactive Section
This section is part of the Complexity: Beginner lesson on DataDriven, a free data engineering interview prep platform. Each section includes explanations, worked examples, and hands-on code challenges that execute in real time. SQL queries run against a live PostgreSQL database. Python runs in a sandboxed Docker container. Data modeling problems validate against interactive schema canvases. All content is framed around what data engineering interviewers actually test at companies like Meta, Google, Amazon, Netflix, Stripe, and Databricks.
How DataDriven Lessons Work
DataDriven combines four interview rounds (SQL, Python, Data Modeling, Pipeline Architecture) with adaptive difficulty and spaced repetition. Easy problems get harder as you improve. Weak concepts resurface until you master them. Your readiness score tracks progress across every topic interviewers test. Every lesson section ends with problems you solve by writing and running real code, not by picking multiple-choice answers.