Edge-to-cloud data pipeline in IOT Protocols - Time & Space Complexity
We want to understand how the time to send and process data grows as more devices send data in an edge-to-cloud pipeline.
How does the system handle more data as the number of edge devices increases?
Analyze the time complexity of the following code snippet.
// Pseudocode for edge-to-cloud data pipeline
for each device in devices:
data = device.collectData()
processed = edgeProcessor.process(data)
cloud.send(processed)
This code collects data from each device, processes it at the edge, then sends it to the cloud.
Identify the loops, recursion, array traversals that repeat.
- Primary operation: Loop over all devices to collect and process data.
- How many times: Once per device, so as many times as there are devices.
As the number of devices increases, the total work grows proportionally.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 10 data collections and sends |
| 100 | 100 data collections and sends |
| 1000 | 1000 data collections and sends |
Pattern observation: Doubling devices doubles the work; growth is steady and linear.
Time Complexity: O(n)
This means the time to process data grows directly with the number of devices.
[X] Wrong: "Processing data from multiple devices happens all at once, so time stays the same no matter how many devices there are."
[OK] Correct: Each device's data must be collected and processed separately, so more devices mean more total work and more time.
Understanding how data pipelines scale helps you design systems that handle growth smoothly and predict performance as more devices connect.
"What if edge processing was done in parallel for all devices? How would the time complexity change?"