0
0
Azurecloud~5 mins

Build pipeline basics in Azure - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Build pipeline basics
O(n)
Understanding Time Complexity

When we run a build pipeline in Azure, it performs a series of steps to prepare our code. Understanding how the time it takes grows as we add more tasks helps us plan better.

We want to know: How does the total work increase when the pipeline has more steps?

Scenario Under Consideration

Analyze the time complexity of the following Azure pipeline YAML snippet.

trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

steps:
- script: echo "Step 1"
- script: echo "Step 2"
- script: echo "Step 3"
- script: echo "Step 4"
- script: echo "Step 5"

This pipeline runs five script steps one after another on a virtual machine.

Identify Repeating Operations

Look at the steps that repeat in the pipeline.

  • Primary operation: Each script step runs a command.
  • How many times: Once per step, here 5 times.
How Execution Grows With Input

As we add more steps, the total time grows with the number of steps.

Input Size (n)Approx. Operations
10 steps10 script runs
100 steps100 script runs
1000 steps1000 script runs

Pattern observation: The total work grows directly with the number of steps added.

Final Time Complexity

Time Complexity: O(n)

This means if you double the number of steps, the total time roughly doubles too.

Common Mistake

[X] Wrong: "Adding more steps won't affect total time much because they run fast."

[OK] Correct: Even if each step is quick, more steps add up and increase total time linearly.

Interview Connect

Understanding how pipeline steps add up helps you design efficient builds and shows you can think about scaling work in real projects.

Self-Check

"What if we run some steps in parallel instead of one after another? How would the time complexity change?"