DoS and DDoS attacks in Computer Networks - Time & Space 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.
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.
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.
As the number of attack requests increases, the total operations increase at the same rate.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 10 requests sent |
| 100 | 100 requests sent |
| 1000 | 1000 requests sent |
Pattern observation: Doubling the requests doubles the work done.
Time Complexity: O(n)
This means the effort grows directly in proportion to the number of attack requests.
[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.
Understanding how attack load grows helps you explain system limits and defenses clearly in interviews.
"What if the attack sends requests in parallel instead of one by one? How would the time complexity change?"