## How to fix the below micro bursting

I’m currently in the process to use Traffic Shaping ‘tc’ to apply rule hoping to reduce the bursts. The application use UDP port 49155 (20ms audio packets to other devices) to send audio to other devices and tcpdum on that specific port shows massive burst happening (see Pic1).

Here is the output before applying any tc

I used the following tc code:

``````tc qdisc add dev eth2 root handle 1:0 htb default 30
tc class add dev eth2 parent 1:0 classid 1:1 htb rate 5000bit
tc filter add dev eth2 protocol ip parent 1:0 prio 1 u32 match ip dport 49155  0xffff flowid 1:1
``````

After applying tc the traffic looks like this(see Pic2)

After applying tc

Although the bursts have been reduced now to 5000bit, I feel there are still things missing in the tc class to add like delay maybe? I just don’t want this to affect the quality of the service.

## Performance – Bursting Balloons – Code Review Stack Exchange

This is a leet code problem –

given `n` Balloons, indexed by `0` to `n-1`, Every balloon is painted
with a number on it, represented by an array `nums`, they are asked
burst all the balloons. If you burst the balloon `I` You receive
`nums[left] * nums[i] * nums[right]` Coins. Here `Left` and `Law`
are adjacent indices of `I`, After the outbreak of `Left` and `Law`

Find the maximum number of coins you can collect by letting the balloons burst
wise.

Note –

• you can imagine `nums[-1] = nums[n] = 1`, They are not real, so you can not burst them.
• $$0$$ $$≤$$ `n` $$≤$$ $$500$$$$,$$ $$0$$ $$≤$$ `nums[i]` $$≤$$ $$100$$

Example –

``````Entrance: [3,1,5,8]

Issue: 167

Explanation: nums = [3,1,5,8] -> [3,5,8] ->   [3,8]   ->  [8]  -> []
Coins = 3 * 1 * 5 + 3 * 5 * 8 + 1 * 3 * 8 + 1 * 8 * 1 = 167
``````

Here is my solution to this challenge –

``````# Uses dynamic programming

def max_coins (nums):
"" "
: Type nums: List[int]
: rtype: int
"" "
nums = [1] + nums + [1]
n = len (nums)
dp = [[0] * n for i in range (n)]for j in the range (2, n):
for i in the range (j - 2, -1, -1):
for k in the range (i + 1, j):
dp[i][j]    = max (dp[i][j], dp[i][k]    + dp[k][j]    + nums[i] * nums[j] * nums[k])
return dp[0][-1]
``````

Here's the leetcode result (70 test cases) –

I would like to know if I can make this program shorter and more efficient.

Any help would be appreciated.