0
0
Digital Marketingknowledge~5 mins

Network effects in marketing in Digital Marketing - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Network effects in marketing
O(n²)
Understanding Time Complexity

Network effects in marketing describe how the value of a product or service grows as more people use it.

We want to understand how the impact or reach grows as the number of users increases.

Scenario Under Consideration

Analyze the time complexity of this simple network effect model.


function calculateNetworkValue(users) {
  let value = 0;
  for (let i = 1; i <= users; i++) {
    for (let j = 1; j <= users; j++) {
      if (i !== j) {
        value += 1; // each user connects with every other user
      }
    }
  }
  return value;
}

This code calculates the total number of possible connections between users in a network.

Identify Repeating Operations

Identify the loops, recursion, array traversals that repeat.

  • Primary operation: Counting connections between each pair of users.
  • How many times: The inner loop runs once for every user in the outer loop, so roughly users x users times.
How Execution Grows With Input

As the number of users grows, the number of connections grows much faster.

Input Size (users)Approx. Operations (connections)
1090
1009,900
1000999,000

Pattern observation: When users double, connections roughly quadruple, showing a fast growth.

Final Time Complexity

Time Complexity: O(n²)

This means the work needed grows roughly with the square of the number of users.

Common Mistake

[X] Wrong: "Adding more users only increases connections a little bit."

[OK] Correct: Each new user connects with all existing users, so connections grow very quickly, not slowly.

Interview Connect

Understanding how network effects scale helps you explain why some products become more valuable as more people join.

Self-Check

What if connections only happened between new users and a fixed number of existing users? How would the time complexity change?