0
0
Digital Marketingknowledge~5 mins

Retargeting and remarketing in Digital Marketing - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Retargeting and remarketing
O(n)
Understanding Time 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.

Scenario Under Consideration

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.

Identify Repeating Operations
  • Primary operation: Looping through each user in the audience list.
  • How many times: Once for every user in the list.
How Execution Grows With Input

As the number of users grows, the number of checks and ads shown grows at the same rate.

Input Size (n)Approx. Operations
1010 checks and possible ads
100100 checks and possible ads
10001000 checks and possible ads

Pattern observation: The work grows directly with the number of users.

Final Time Complexity

Time Complexity: O(n)

This means the time to run the campaign grows in a straight line as the audience size grows.

Common Mistake

[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.

Interview Connect

Understanding how campaign effort grows with audience size helps you plan better and shows you can think about efficiency in marketing tasks.

Self-Check

"What if we grouped users by behavior first and then showed ads to groups instead of individuals? How would the time complexity change?"