Building AI into your daily workflow in AI for Everyone - Time & Space Complexity
When we add AI tools to daily tasks, it's important to understand how the time needed grows as tasks get bigger or more complex.
We want to know how the effort or waiting time changes when using AI in workflows.
Analyze the time complexity of the following AI workflow process.
for task in daily_tasks:
input_data = collect_data(task)
ai_result = run_ai_model(input_data)
save_result(ai_result)
This code runs an AI model on each task's data one by one and saves the results.
Look for repeated steps that take time.
- Primary operation: Running the AI model on each task's data.
- How many times: Once for every task in the list.
As the number of tasks grows, the total time grows too.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 10 AI model runs |
| 100 | 100 AI model runs |
| 1000 | 1000 AI model runs |
Pattern observation: The time grows directly with the number of tasks; doubling tasks doubles the time.
Time Complexity: O(n)
This means the total time increases in a straight line as you add more tasks.
[X] Wrong: "Running AI on multiple tasks at once will always take the same time as one task."
[OK] Correct: Each task needs its own AI processing, so more tasks mean more total time.
Understanding how AI processing time grows with tasks helps you explain efficiency and plan workflows clearly.
"What if we could run AI models on all tasks at the same time? How would the time complexity change?"