0
0
Azurecloud~5 mins

Logic Apps for visual workflows in Azure - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Logic Apps for visual workflows
O(n)
Understanding Time Complexity

When using Logic Apps to build workflows, it is important to understand how the time to complete tasks grows as the workflow handles more data or steps.

We want to know how the number of actions affects the total execution time.

Scenario Under Consideration

Analyze the time complexity of a Logic App that processes a list of items by looping through each item and calling an API.


    {
      "definition": {
        "actions": {
          "For_each": {
            "type": "Foreach",
            "foreach": "@triggerBody()?['items']",
            "actions": {
              "Call_API": {
                "type": "Http",
                "inputs": { "method": "GET", "uri": "https://example.com/api" }
              }
            }
          }
        }
      }
    }
    

This workflow loops over each item in a list and calls an external API once per item.

Identify Repeating Operations

Identify the API calls, resource provisioning, data transfers that repeat.

  • Primary operation: HTTP API call inside the loop.
  • How many times: Once per item in the input list.
How Execution Grows With Input

As the number of items increases, the Logic App makes more API calls, one for each item.

Input Size (n)Approx. API Calls/Operations
1010 API calls
100100 API calls
10001000 API calls

Pattern observation: The number of API calls grows directly with the number of items.

Final Time Complexity

Time Complexity: O(n)

This means the total execution time increases linearly as the number of items grows.

Common Mistake

[X] Wrong: "The Logic App runs all API calls at the same time, so time stays the same no matter how many items."

[OK] Correct: While some parallelism is possible, each API call still takes time, and the total time grows roughly with the number of calls.

Interview Connect

Understanding how workflows scale with input size helps you design efficient cloud solutions and explain your reasoning clearly in interviews.

Self-Check

"What if the Logic App used batch API calls instead of one call per item? How would the time complexity change?"