From c04ac92f358887ee94d0d5da7e529570091b9b70 Mon Sep 17 00:00:00 2001 From: rohitsekar1996 Date: Wed, 3 Oct 2018 01:14:33 +0530 Subject: [PATCH 1/4] Update contributors.md --- contributors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributors.md b/contributors.md index 249a928..8d57df3 100644 --- a/contributors.md +++ b/contributors.md @@ -24,4 +24,4 @@ 21. [Ankit Bajaj](https://github.com/ankit10101) 22. [Medha Sharma](https://github.com/medhasharma) 23. [Pritish Thakkar](https://github.com/ma5terdrag0n) -23. [Your Name](https://github.com/yourprofile) \ No newline at end of file +23. [Rohit Sekar](https://github.com/rohitsekar1996) From 99410a98b7fdee7e3d9a8594b72c52ba1c9c269e Mon Sep 17 00:00:00 2001 From: rohitsekar1996 Date: Wed, 3 Oct 2018 01:23:32 +0530 Subject: [PATCH 2/4] Create eucledian.c --- Algorithms/eucledian.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Algorithms/eucledian.c diff --git a/Algorithms/eucledian.c b/Algorithms/eucledian.c new file mode 100644 index 0000000..129e3a5 --- /dev/null +++ b/Algorithms/eucledian.c @@ -0,0 +1,30 @@ + +// Euclidean Algorithm +#include + +// C function for extended Euclidean Algorithm +int gcdExtended(int a, int b, int *x, int *y) +{ + // Base Case + if (a == 0) + { + *x = 0; + *y = 1; + return b; + } + + int x1, y1; // To store results of recursive call + int gcd = gcdExtended(b%a, a, &x1, &y1); + *x = y1 - (b/a) * x1; + *y = x1; + + return gcd; +} +int main() +{ + int x, y; + int a = 35, b = 15; + int g = gcdExtended(a, b, &x, &y); + printf("gcd(%d, %d) = %d", a, b, g); + return 0; +} From 0dda35e6dc7ebe85c2a4bd74804f76942876c47c Mon Sep 17 00:00:00 2001 From: Rohit Sekar Date: Fri, 26 Oct 2018 22:44:26 +0530 Subject: [PATCH 3/4] sliding window proctol in c++ --- Algorithms/Sliding window algorithm | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Algorithms/Sliding window algorithm diff --git a/Algorithms/Sliding window algorithm b/Algorithms/Sliding window algorithm new file mode 100644 index 0000000..b84845e --- /dev/null +++ b/Algorithms/Sliding window algorithm @@ -0,0 +1,36 @@ +#include + +int main() +{ + int w,i,f,frames[50]; + + printf("Enter window size: "); + scanf("%d",&w); + + printf("\nEnter number of frames to transmit: "); + scanf("%d",&f); + + printf("\nEnter %d frames: ",f); + + for(i=1;i<=f;i++) + scanf("%d",&frames[i]); + + printf("\nWith sliding window protocol the frames will be sent in the following manner (assuming no corruption of frames)\n\n"); + printf("After sending %d frames at each stage sender waits for acknowledgement sent by the receiver\n\n",w); + + for(i=1;i<=f;i++) + { + if(i%w==0) + { + printf("%d\n",frames[i]); + printf("Acknowledgement of above frames sent is received by sender\n\n"); + } + else + printf("%d ",frames[i]); + } + + if(f%w!=0) + printf("\nAcknowledgement of above frames sent is received by sender\n"); + + return 0; +} From d5d6d1571c59d7a17fd87ae5bc329857d2177325 Mon Sep 17 00:00:00 2001 From: Rohit Sekar Date: Fri, 26 Oct 2018 22:46:01 +0530 Subject: [PATCH 4/4] Update contributors.md --- contributors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributors.md b/contributors.md index 8d57df3..3a80c73 100644 --- a/contributors.md +++ b/contributors.md @@ -24,4 +24,4 @@ 21. [Ankit Bajaj](https://github.com/ankit10101) 22. [Medha Sharma](https://github.com/medhasharma) 23. [Pritish Thakkar](https://github.com/ma5terdrag0n) -23. [Rohit Sekar](https://github.com/rohitsekar1996) +24. [Rohit Sekar](https://github.com/rohitsekar1996)