0
0
Computer Networksknowledge~5 mins

DoS and DDoS attacks in Computer Networks - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: DoS and DDoS attacks
O(n)
Understanding Time Complexity

When studying DoS and DDoS attacks, it's important to understand how the attack effort grows as more requests are sent.

We want to know how the number of attack requests affects the load on the target system.

Scenario Under Consideration

Analyze the time complexity of this simplified attack simulation:

for request in attack_requests:
    send request to target_server
    wait for response or timeout
    log result
    

This code sends many attack requests one after another to overload the target server.

Identify Repeating Operations

Look at what repeats as the attack grows:

  • Primary operation: Sending each attack request to the server.
  • How many times: Once for every request in the attack list.
How Execution Grows With Input

As the number of attack requests increases, the total operations increase at the same rate.

Input Size (n)Approx. Operations
1010 requests sent
100100 requests sent
10001000 requests sent

Pattern observation: Doubling the requests doubles the work done.

Final Time Complexity

Time Complexity: O(n)

This means the effort grows directly in proportion to the number of attack requests.

Common Mistake

[X] Wrong: "Sending more requests will only slightly increase the load because servers handle many requests easily."

[OK] Correct: Each request adds work for the server, so more requests linearly increase the load and can overwhelm it.

Interview Connect

Understanding how attack load grows helps you explain system limits and defenses clearly in interviews.

Self-Check

"What if the attack sends requests in parallel instead of one by one? How would the time complexity change?"