File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #include < cstdlib>
2+ #include < iostream>
3+ #include < unistd.h>
4+ using namespace std ;
5+ // Program to demonstrate leaky bucket algorithm
6+ int main ()
7+ {
8+ int bs,outr,ip,cbs=0 ,i;
9+ // Assign zero to current bucket size
10+ cout << " Enter Bucket Size and Output rate " << endl;
11+ cin >> bs >> outr;
12+ // input Bucket size and output rate
13+ cout << " Input Packet Current Bucket Output Discarded" << endl;
14+ for (i=0 ;i<200 ;i++)
15+ {
16+ ip=rand ()%201 ;
17+ // random functions chooses the number randomly for input packet
18+ cbs+=ip;
19+ if (cbs>(bs+outr))
20+ {
21+ cout << ip<<" \t " <<bs<<" \t " <<outr<<" \t " <<cbs-(bs+outr)<<endl;
22+ cbs=bs;
23+ }
24+ else
25+ {
26+ if (cbs<outr)
27+ cout << ip<<" \t " <<cbs<<" \t " <<" 0\t " <<" 0" <<endl;
28+ else
29+ {
30+ cbs-=outr;
31+ cout << ip<<" \t " <<cbs<<" \t " <<outr<<" \t " <<" 0" <<endl;
32+ }
33+ sleep (1 );
34+ }
35+ }
36+ return 0 ;
37+ }
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ Inverse Fast Fourier Transform | | | | | :+1: | | | |
4141Johnson algorithm | :+1 : | :+1 : | | | :+1 : | | | |
4242Kadane's algorithm | :+1 : | :+1 : | | :+1 : | :+1 : | :+1 : | :+1 : | |
4343Knuth Morris Prath Algorithm | :+1 : | :+1 : | | | :+1 : | | | |
44+ Leaky-Bucket | | | | | :+1 : | | | |
4445LinearSearch | :+1 : | :+1 : | :+1 : | :+1 : | :+1 : | :+1 : | :+1 : | | | :+1 : |
4546Longest common subsequence | :+1 : | :+1 : | | :+1 : | :+1 : | | | | :+1 :
4647Longest increasing subsequence | :+1 : | :+1 : | | | :+1 : | | | |
@@ -470,6 +471,8 @@ Extended Euclidean algorithm | | | | |:+1:| | | |
470471
471472* Lesk algorithm : word sense disambiguation
472473
474+ * Leaky bucket algorithm : an algorithm that demonstrates traffic control in network transmission
475+
473476* Levenberg–Marquardt algorithm : An algorithm for solving nonlinear least squares problems.
474477
475478* Levenshtein edit distance : compute a metric for the amount of difference between two sequences
You can’t perform that action at this time.
0 commit comments