Retargeting and remarketing in Digital Marketing - Time & Space Complexity
When running retargeting and remarketing campaigns, it is important to understand how the time and effort needed grow as your audience size increases.
We want to know how the work involved changes when you target more users.
Analyze the time complexity of the following campaign process.
// For each user in the audience list
for user in audience_list:
# Check if user visited the website
if user.visited_website:
# Show personalized ad
show_ad(user)
# Else, do nothing
This code checks each user to see if they visited the website and then shows them a personalized ad if they did.
- Primary operation: Looping through each user in the audience list.
- How many times: Once for every user in the list.
As the number of users grows, the number of checks and ads shown grows at the same rate.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 10 checks and possible ads |
| 100 | 100 checks and possible ads |
| 1000 | 1000 checks and possible ads |
Pattern observation: The work grows directly with the number of users.
Time Complexity: O(n)
This means the time to run the campaign grows in a straight line as the audience size grows.
[X] Wrong: "Showing ads to more users only takes a little more time because ads are automated."
[OK] Correct: Even automated ads require checking each user's data, so more users mean more work and time.
Understanding how campaign effort grows with audience size helps you plan better and shows you can think about efficiency in marketing tasks.
"What if we grouped users by behavior first and then showed ads to groups instead of individuals? How would the time complexity change?"