We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
There is a 2d array of size n x 2, requests. At time t = requests[i][0], requests[i][1] packets are to be sent over the network. The network can hold at most max_packets packets in the pipeline. It delivers the data to the client at rate packets per second, i.e. rate packets are removed from the queue and delivered to the client every second.
If the number of packets exceeds max_packets at any time, the packets remaining at that time are dropped.
Given the array requests, and the integers, max_packets, and rate, find the total number of packets that are dropped.
Insertion Sort Advanced Analysis
You are viewing a single comment's thread. Return to all comments →
Implement a prototype of a UDP network protocol.
There is a 2d array of size n x 2, requests. At time t = requests[i][0], requests[i][1] packets are to be sent over the network. The network can hold at most max_packets packets in the pipeline. It delivers the data to the client at rate packets per second, i.e. rate packets are removed from the queue and delivered to the client every second.
If the number of packets exceeds max_packets at any time, the packets remaining at that time are dropped.
Given the array requests, and the integers, max_packets, and rate, find the total number of packets that are dropped.
Example
Suppose requests = [[1, 8], [4, 9], [6, 7]], rate = 2, and max_packets= 10.