Protocol selection criteria (bandwidth, power, latency) in IOT Protocols - Time & Space Complexity
When choosing an IoT protocol, we want to know how its performance changes as we increase data or devices.
We ask: How does bandwidth, power use, and latency affect the protocol's speed and efficiency?
Analyze the time complexity of the following protocol data transmission simulation.
// Simulate sending data packets over a protocol
function sendPackets(packetCount) {
for (let i = 0; i < packetCount; i++) {
transmit({size: 100}); // send one packet
}
}
function transmit(packet) {
// Simulate transmission delay based on packet size
delay(packet.size / bandwidth);
}
This code sends packets one by one, each taking time based on size and bandwidth.
Look for repeated actions that take most time.
- Primary operation: Loop sending each packet once.
- How many times: Equal to the number of packets (packetCount).
As the number of packets grows, total time grows too.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 10 transmissions |
| 100 | 100 transmissions |
| 1000 | 1000 transmissions |
Pattern observation: Time grows directly with the number of packets sent.
Time Complexity: O(n)
This means if you double the packets, the total time roughly doubles too.
[X] Wrong: "Sending more packets won't affect total time much because each is small."
[OK] Correct: Even small packets add up; sending many packets means more total time.
Understanding how protocol time grows with data helps you pick the right one for your IoT project and shows you can think about real system limits.
"What if packets could be sent in parallel instead of one by one? How would the time complexity change?"