Writing marketing copy with AI in AI for Everyone - Time & Space Complexity
When using AI to write marketing copy, it is important to understand how the time taken grows as the amount of text or input increases.
We want to know how the AI's work time changes when we ask it to create more or longer pieces of copy.
Analyze the time complexity of the following AI marketing copy generation process.
function generateCopy(prompts) {
let results = [];
for (let prompt of prompts) {
let copy = aiModel.createCopy(prompt);
results.push(copy);
}
return results;
}
This code takes a list of prompts and uses an AI model to create marketing copy for each prompt one by one.
Identify the loops, recursion, array traversals that repeat.
- Primary operation: Calling the AI model to generate copy for each prompt.
- How many times: Once for each prompt in the input list.
As the number of prompts increases, the total time grows roughly in direct proportion.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 10 AI copy generations |
| 100 | 100 AI copy generations |
| 1000 | 1000 AI copy generations |
Pattern observation: Doubling the number of prompts roughly doubles the total work time.
Time Complexity: O(n)
This means the time to generate marketing copy grows directly with the number of prompts you give the AI.
[X] Wrong: "The AI generates all copies instantly no matter how many prompts there are."
[OK] Correct: Each prompt requires the AI to do work, so more prompts mean more time overall.
Understanding how AI tasks scale with input size helps you explain performance in real projects and shows you can think about efficiency clearly.
"What if the AI could generate copy for all prompts at the same time? How would that change the time complexity?"