# data[].attributes.body
1.Initiate incoming packet
If the buffer is full,
Discharge the packet
Else
Put the packet to the queue
2.Check condition of queue
If queue is full,
Hold the packet in the buffer
Else
Check the size of the available slot in the queue
Then
Push the ideal size packet to the queue
3.First packet in queue,
Send to it’s destination
Others,
Wait for their turn in queue

# data[].attributes.body
The leaky bucket algorithm is a method of temporarily storing a variable number of requests and organizing them into a set-rate output of packets in an asynchronous transfer mode (ATM) network. The leaky bucket is used to implement traffic policing and traffic shaping in Ethernet and cellular data networks.

The following is an algorithm for variable-length packets:

1. Initialize a counter to n at the tick of the clock.

2. If n is greater than the size of the packet, send the packet and decrement the counter by the packet size. Repeat this step until n is smaller than the packet size.

3. Reset the counter and go to step 1.

Example:
Let n=1000
Packet=
Since n> front of Queue i.e. n>200
Therefore, n=1000-200=800
Packet size of 200 is sent to the network.

Now Again n>front of the queue i.e. n > 400
Therefore, n=800-400=400
Packet size of 400 is sent to the network.

Since n< front of queue Therefore, the procedure is stop.

And we initialize n=1000 on another tick of clock.
This procedure is repeated until all the packets are sent to the network.

# data[].attributes.body
1. Start

2. get random number of packets

3. initialize inter arrival time=0; initialize packet =0;

4. Set the packet size and the buffer size and Queue size

5. Set the output rate.

6. Transmit the packets such that there is no overflow.

7. Repeat the process of transmission until all packets are transmitted. (Reject packets where its size is greater than the buffer size)

8. Stop

# data[].attributes.body
Step 1:- Initialize

n=number of packets at every tick of clock
S=size of buffer

F= number of frames in Que.

Step 2:- Send n packets to the buffer

If      n < S then push packets to Que F and decrease speed of packets.

Step 3: If number of slots in Que is full.

Hold the number of packets.

But If n = S in the buffer

Then End the Process.

# data[].attributes.body
1.Initiate incoming packet
If the buffer is full,
Discharge the packet
Else
Put the packet to the queue
2.Check condition of queue
If queue is full,
Hold the packet in the buffer
Else
Check the size of the available slot in the queue
Then
Push the ideal size packet to the queue
3.First packet in queue,
Send to it’s destination
Others,
Wait for their turn in queue

# data[].attributes.body
1- initialize the counter to n at every tick of clock
2-if n is greater than the size of packet in the front of queue send the packet into the network and decrement the counter by size of packet
Repeat the step until n is less than the size of packet
3- reset the counter and go to step 1

# data[].attributes.body
1.Initialize packet
2.Receive a frame
3.Define incoming time
4.Fill the frame with the token
5.Decide the token quantity
6.check the packet store
7.if have an error, than go to the end
8.if no error and all true, create packet transmission request.
9.send the packet to destination

# data[].attributes.body
Incoming Packet to the buffer initialize as n at constant time

Check if buffer full
Discard

Else Check status of the queue

if the queue is able to receive packets push the holded packets in buffer to the queue
Then send to destination

Else Hold packets until the available Slot in the queue can accept the size of the 1st packet waiting in the buffer

# data[].attributes.body
1.       The leaky bucket takes data and

2.       If the buffer is not full collects the data

3.       If the buffer is full then drop the packet

4.        Data in the buffer is only released from the buffer at a set rate and size of packet.

5.       When the buffer runs out of data, the leaking stops.

6.        If incoming data would overfill the buffer then discard

7.        Then, the packet is considered to be non-conformant and is not added to the bucket.

8.       Then the buffer will check if the queue empty

9.       If the is queue is empty

10.   Then data to be send should be less than or equal to the available Queue size

a.       Then Push the data to the queue

11.   Data is added to the bucket as space becomes available for conforming packets.

# data[].attributes.body
leaky bucket algorithm
[1] Set the counter
[2] wait for the clock tick
[3] size of the frame at the front of queue less than or equal to the value of the counter
[4] if yes , send it to frame
& Decrement the counter
else
[5] Rest the counter

# data[].attributes.body
Consider buffert size of 1000. The queued packets are as follows 200, 800, 450, 400, 200. In step 1, the bucket size is greater than packet size (1000>200). Remaining bucket size will be 800 (1000-200). In step 2, the bucket size is greater than packet size (800>400). Remaining buffer size will be 400 (800-400). In step 3, the bucket size is smaller than packet size (400<450). The process stopped. The remaining packets will be dropped. In leaky bucket algorithm, Adjustable bucket size and flow rate decreases the number of packets dropped in the network.><450)

The process stopped. The remaining packets will be dropped. In leaky bucket algorithm, Adjustable buffer size and flow rate decreases the number of packets dropped in the network.

# data[].attributes.body
1. initialize the counter to (N) at every tick of clock .
2. if (N) is greater than size of packet in front of queue send the packet into network and decrements the counter by  size of packet . repeat the step until (N) is less than size of packet .
3. reset the counter and go to step 1 .

# data[].attributes.body
An algorithm (pronounced AL-go-rith-um) is a procedure or formula for solving a problem, based on conductiong a sequence of specified actions. A computer program can be viewed as an elaborate algorithm. In mathematics and computer science, an algorithm usually means a small procedure that solves a recurrent problem

At the arrival of the first packet, the content of the bucket is set to zero and the last

conforming time (LCT) is set to the arrival time of the first packet.  The depth of the bucket is L+I, where l depends on the traffic burstiness. At the arrival of the kth packet, the auxiliary variable X’ records the difference between the bucket content at the arrival of the last conforming packet and the interarrival time between the last conforming packet and the kth packet.  If the auxiliary variable is greater than L, the packet is considered as nonconforming,otherwise the packet is conforming. The bucket content and the arrival time of the packet are then updated.

# data[].attributes.body
Step 1 - Initialize the 'n' size at each clock
Step 2 - Compare the n size with the packet size which is in front of queue.
Step 3 - If the n size is greater than packet size, then send the packet to the network.
Step 4 - The step is continuously repeated from step 2 to step 3 until the n size is lower than current packet size.
Step 5 - The process is stop.

# data[].attributes.body
Algorithm
Step - 1 : Initialize the counter to ‘n’ at every tick of clock.
Step - 2 : If n is greater than the size of packet in the front of queue send the packet into the network and decrement the counter by size of packet. Repeat the step until n is less than the size of packet.
Step - 3 : Reset the counter and go to Step - 1.
Step - 4 : Since N< front of Queue
Therefore, the procedure is stop.

# data[].attributes.body
Initialize a start clock =0.
Initialize queue.
Initialize buffer.
Initialize packet size.

buffer
- if buffer isn't full,

-If queue is not full and packet size is less than or equal to available queue size, push to queue and forward a new packet to destination.
-Else hold incoming packet in buffer
Else drop packet

# data[].attributes.body
A simple leacky bucket algorithm use FIFO queue.
The following is an algorithm for variable-length packets:

1. Initialize a counter to n at the tick of the clock.

2. If n is greater than the size of the packet, send the packet and decrement the counter by the packet size. Repeat this step until n is smaller than the packet size.

3. Reset the counter and go to step 1.

Example:
Let n=1000
Packet=
Since n> front of Queue i.e. n>200
Therefore, n=1000-200=800
Packet size of 200 is sent to the network.

Now Again n>front of the queue i.e. n > 400
Therefore, n=800-400=400
Packet size of 400 is sent to the network.

Since n< front of queue Therefore, the procedure is stop.
If the queue is full then it is discharge/stop/hold for next counter. Else the procedure continue until n is smaller than packet size.

And we initialize n=1000 on another tick of clock.
This procedure is repeated until all the packets are sent to the network.