Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
8 views
CN LAB Small
Uploaded by
Saalif Rahman
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download now
Download
Save CN LAB small For Later
Download
Save
Save CN LAB small For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
8 views
CN LAB Small
Uploaded by
Saalif Rahman
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download now
Download
Save CN LAB small For Later
Carousel Previous
Carousel Next
Save
Save CN LAB small For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 3
Search
Fullscreen
DIJKSTRA’S ALGORITHM
#include<stdio.h>----void main() ----{ ----int path[5][5],i, j, min, a[5][5],p,
st=1,ed=5,stp,edp,t[5],index; ----printf("Enter the cost matrix\n"); ----
for(i=1;i<=5;i++) ----for(j=1;j<=5;j++) ----scanf("%d", &a[i][j]); ----
printf("Enter the paths\n"); ----scanf("%d", &p); ----printf("Enter possible
paths\n"); ----for(i=1;i<=p; i++) ----for(j=1;j<=5;j++) ----scanf("%d", &path[i]
[j]); ----for(i=1;i<=p; i++) ----{ ----t[i]=0; ----stp=st; ----for(j=1;j<=5;j++) ----
{ ----edp=path[i][j+1]; ----t[i]=t[i]+a[stp][edp]; ----if(edp==ed) ----break; ----
else ----stp=edp; ----} ----} ----min=t[st];index=st; ----for(i=1;i<=p; i++) ----
{ ----if(min>t[i]) ----{ ----min=t[i]; ----index=i; ----} ----} ----printf("Minimum
cost %d", min); ----printf("\n Minimum cost path "); ----for(i=1;i<=5;i++)----
{----printf("--> %d", path[index][i]); ----if(path[index][i]==ed) ----break;
----}----OUTPUT----INPUT: ----5 10 5 8 2 0 9 8 3 7 3 3 5 2 7 0 0 12 14 5 0 16 4 0 2 1 0 ----
OUTPUT: ----Enter no. of vertices: ----Enter the adjacency matrix: ----Enter the starting node:----
Distance of node1=5 Path=1<-0 ---Distance of node2=8 Path=2<-0 ----Distance of node3=2 Path=3<-0
----Distance of node4=8 Path=4<-1<-0
BIT STUFFING:
#include<string.h> ----int main() ----{ ----int a[20],b[30],i,j,k,count,n; ---
printf("Enter frame size "); ----scanf("%d",&n); ----printf("Enter the frame in
the form of 0 and 1 :"); ----for(i=0; i<n; i++) ----scanf("%d",&a[i]); ----i=0; ----
count=1; ----j=0; ----while(i<n) ----{ ----if(a[i]==1) ----#include<stdio.h> ----
{ ----b[j]=a[i]; ----for(k=i+1; a[k]==1 && k<n && count<5; k++) ----{ ----j++;
----b[j]=a[k]; ----count++; ----if(count==5) ----{ ---j++; ----b[j]=0; ----} ----i=k;
----} ----} ----else ----{ ----b[j]=a[i]; ----} ----i++;----j++; ----} ----printf("After Bit
Stuffing :");----for(i=0; i<j; i++) ----printf("%d",b[i]); ----return 0; ----}
OUTPUT----Enter frame size :12 ----Enter the frame in the form of 0 and 1 :0 1 0 1 1 1 1 1 1 0 0 1 ----After Bit
Stuffing :0 1 0 1 1 1 1 1 0 1 0 0 1
BYTE STUFFING
#include<stdio.h> ----#include<string.h> ----main() ----{ ----char a[30], fs[50]
= " ", t[3], sd, ed, x[3], s[3], d[3], y[3]; ----int i, j, p = 0, q = 0; ----clrscr(); ----
printf("Enter characters to be stuffed:"); ----scanf("%s", a); ----printf("\
nEnter a character that represents starting delimiter:"); ----scanf(" %c",
&sd); ----printf("\nEnter a character that represents ending delimiter:"); ----
scanf(" %c", &ed); ----x[0] = s[0] = s[1] = sd;
x[1] = s[2] = '\0'; ----y[0] = d[0] = d[1] = ed; ----d[2] = y[1] = '\0'; ----strcat(fs,
x); ----for(i = 0; i < strlen(a); i++) ----{ ----t[0] = a[i]; ----t[1] = '\0'; ----if(t[0] ==
sd) ----strcat(fs, s); ---else if(t[0] == ed) ----strcat(fs, d); ----else ----strcat(fs,
t); ----} ----strcat(fs, y); ----printf("\n After stuffing:%s", fs); ----getch();
----}----OUTPUT-Enter string ----OnlineSmartTrainer Enter position Enter the character ----k ----Frames after
character stuffing: DlestxOnlined lekd leSmartTrainerd leetx
CRC
#include<stdio.h> ----char data[20],div[20],temp[4],total[100]; ----int
i,j,datalen,divlen,len,flag=1; ----void check(); ----int main() ----{ ----
printf("Enter the total bit of data:"); ----scanf("%d",&datalen); ----printf("\
nEnter the total bit of divisor"); ----scanf("%d",&divlen); ----
len=datalen+divlen-1; ----printf("\nEnter the data:"); ----scanf("%s",&data);
----printf("\nEnter the divisor"); ----scanf("%s",div);
for(i=0;i<datalen;i++) ----{ ----total[i]=data[i]; ----temp[i]=data[i]; ----} ----
for(i=datalen;i<len;i ----total[i]='0'; ----check(); ----for(i=0;i<divlen;i++) ----
temp[i+datalen]=data[i]; ----printf("\ntransmitted Code Word:%s",temp);
printf("\n\nEnter the received code word:"); ----scanf("%s",total); ----
check(); ----for(i=0;i<divlen-1;i++) ----if(data[i]=='1') ----{ ----flag=0; ----
break; ----} ----if(flag==1)----printf("\nsuccessful!!"); ----else----printf("\
nreceived code word contains errors...\n"); ----} ----void check() ----{ ----
for(j=0;j<divlen;j++) ----data[j]=total[j]; ----while(j<=len) ----{
if(data[0]=='1') ----for(i = 1;i <divlen ; i++) ----data[i] = (( data[i] ==
div[i])?'0':'1'); ----for(i=0;i<divlen-1;i++) ----data[i]=data[i+1]; ----
data[i]=total[j++]; ----} ----} OUTPUT- ----Enterdata: 1001010 ----Enter key: 1011 ----
Quotient is 1010101 ----Reminder is 111 ----Final data is 10010110111
DISTANCE VECTOR ROUTING
#include<stdio.h> ----struct node ----{ ----unsigned dist[20]; ----unsigned
from[20]; ----}----rt[10]; ----int main() ----{ ----int costmat[20][20]; ----int
nodes,i,j,k,count=0; ----printf("\nEnter the number of nodes : "); ----
scanf("%d",&nodes);----printf("\nEnter the cost matrix :\n"); ----
for(i=0;i<nodes;i++) ----{ ----for(j=0;j<nodes;j++) ----{ ----
scanf("%d",&costmat[i][j]); ----costmat[i][i]=0; ----rt[i].dist[j]=costmat[i][j];----
rt[i].from[j]=j; ----} ----} ----do ----{ ----count=0; ----for(i=0;i<nodes;i++) ----
for(j=0;j<nodes;j++) ----for(k=0;k<nodes;k++) ---if(rt[i].dist[j]>costmat[i][k]
+rt[k].dist[j]) ---{----rt[i].dist[j]=rt[i].dist[k]+rt[k].dist[j]; ----rt[i].from[j]=k; ----
count++; ----} ---}----while(count!=0); ----for(i=0;i<nodes;i++)----{ ----printf("\
n\n For router %d\n",i+1); ----for(j=0;j<nodes;j++) ----{ ----printf("\t\nnode
%d via %d Distance %d ",j+1,rt[i].from[j]+1,rt[i].dist[j]); ----} ----} ----printf("\
n\n"); ----getch(); ----}
LEAKY BUCKET ALGORITHM:
#include<stdio.h> ----#include<conio.h> ----int main(){ ----int incoming,
outgoing, buck_size, n, store = 0; ----clrscr(); ----printf("Enter bucket size,
outgoing rate and no of inputs: "); ----scanf("%d %d %d", &buck_size,
&outgoing, &n); ----while (n != 0) { ----printf("Enter the incoming packet size
: "); ----scanf("%d", &incoming); ----printf("Incoming packet size %d\n",
incoming); ---if (incoming <= (buck_size - store)){ ----store += incoming; ----
printf("Bucket buffer size %d out of %d\n", store, buck_size); ----} else { ----
printf("Dropped %d no of packets\n", incoming - (buck_size - store)); ----
printf("Bucket buffer size %d out of %d\n", store, buck_size); ----store =
buck_size; ----} ----store = store - outgoing; ----printf("After outgoing %d
packets left out of %d in buffer\n", store, buck_size); ----n--; ----}----}
Sliding Window Protocol
#include<stdio.h> ----#include<stdlib.h> ----void main() ----{ ----int i,j,k,n,s,r;
----clrscr(); ----printf("Enter no of frames: "); ----scanf("%d",&n); ----
printf("Enter the window size: "); ----scanf("%d",&s); ----r=rand()%(n+1); ----
printf("The random number is %d\n",r); ----i=1; ----while(i<=n) ----{ ----j=i;
----for(k=1;k<=s;k++) ----{ ----if(i<=n) ----{ ----printf("%d frame has
transmitted\n",i); ----} ----i++; ----} ----printf("Window size completed\n"); ----
for(k=1;k<=s;k++) ----{ ----if(j<=n && r!=j) ----{ ----printf("%d frame has got
ACK\n",j); ----} ----j++; ----} ----printf("\n"); ----} ----if(r>0 && r<=n) ----{ ----
printf("%d frame ACK missed so the packet has to be retransmitted \n\
n",r); ----i=r; ----while(i<=n) ----{ ----j=i; ----for(k=1;k<=s;k++) ----{ ----if(i<=n)
----{ ----printf("%d frame has transmitted \n",i); ----} ----i++; ----} ----
printf("Window size completed \n"); ----for(k=1;k<=s;k++) ----{ ----if(j<=n)
----{ ----printf("%d frame has got ACK\n",j); ----} ----j++; ----} ----printf("\n");
----}----}----}
Open shortest first algorithm
#include<stdio.h> ----#include<string.h> ----int main() ----{ ----int count,src_router,i,j,k,w,v,min; ----int
cost_matrix[100][100],dist[100],last[100]; ----int flag[100]; ----printf("\nEnter the no of routers: "); ----
scanf("%d",&count); ----printf("\n Enter the cost matrix values: "); ----for(i=0;i<count;i++) ----{ ----
for(j=0;j<count;j++) ----{ ----printf("\n%d->%d:",i,j); ----scanf("%d",&cost_matrix[i][j]); ----
if(cost_matrix[i][j]<0)cost_matrix[i][j]=1000; ----} ----} ----printf("\n Enter the source router: ");----
scanf("%d",&src_router); ----for(v=0;v<count;v++) ----{ ----flag[v]=0; ----last[v]=src_router; ----
dist[v]=cost_matrix[src_router][v]; ----} ----flag[src_router]=1; ----for(i=0;i<count;i++) ----{ ----
min=1000; ----for(w=0;w<count;w++) ----{ ----if(!flag[w]) ----if(dist[w]<min) ----{ ----v=w; ----
min=dist[w]; ----} ----} ----flag[v]=1; ----for(w=0;w<count;w++) ----{ ----if(!flag[w]) ----
if(min+cost_matrix[v][w]<dist[w]) ----{ ----dist[w]=min+cost_matrix[v][w];----last[w]=v; ----} ----} ----}
----for(i=0;i<count;i++) ----{ ----printf("\n%d==>%d:Path taken:%d",src_router,i,i); ----w=i; ----while(w!
=src_router) ----{ ----printf("\n<--%d",last[w]);w=last[w]; ----} ----printf("\n Shortest path cost:
%d",dist[i]); ----} ----}
You might also like
Touchet 6 Guidelines 3.28.2024
PDF
No ratings yet
Touchet 6 Guidelines 3.28.2024
24 pages
Data Centers & Cloud Infrastructure - Credit Suisse - 8 Apr 2021
PDF
No ratings yet
Data Centers & Cloud Infrastructure - Credit Suisse - 8 Apr 2021
141 pages
CN Lab
PDF
No ratings yet
CN Lab
5 pages
CN Lab prog-BH
PDF
No ratings yet
CN Lab prog-BH
12 pages
CN Lab
PDF
No ratings yet
CN Lab
26 pages
Computer Networks Lab
PDF
No ratings yet
Computer Networks Lab
15 pages
Cn&os Lab Executed Codes
PDF
No ratings yet
Cn&os Lab Executed Codes
24 pages
Badrichit
PDF
No ratings yet
Badrichit
6 pages
CN_LAB
PDF
No ratings yet
CN_LAB
13 pages
NC-Unique Byte codes for System configuration
PDF
No ratings yet
NC-Unique Byte codes for System configuration
36 pages
Codes
PDF
No ratings yet
Codes
4 pages
1111
PDF
No ratings yet
1111
1 page
All Programs
PDF
No ratings yet
All Programs
6 pages
Rr University Networking Practical notes
PDF
No ratings yet
Rr University Networking Practical notes
12 pages
CN Lab
PDF
No ratings yet
CN Lab
33 pages
CN and WP Lab Manual
PDF
No ratings yet
CN and WP Lab Manual
101 pages
CN LAB
PDF
No ratings yet
CN LAB
20 pages
AIM:-Implement The Data Link Layer Framing Bit Stuffing Method. Program
PDF
No ratings yet
AIM:-Implement The Data Link Layer Framing Bit Stuffing Method. Program
17 pages
Write A C Program To Simulate Bit Stuffing and De-Stuffing
PDF
No ratings yet
Write A C Program To Simulate Bit Stuffing and De-Stuffing
23 pages
Computer Networks
PDF
No ratings yet
Computer Networks
29 pages
CN&NP LAB Manual R13 Regulation
PDF
No ratings yet
CN&NP LAB Manual R13 Regulation
82 pages
CN All Programs
PDF
No ratings yet
CN All Programs
25 pages
Padi
PDF
No ratings yet
Padi
7 pages
CN - PART B
PDF
No ratings yet
CN - PART B
17 pages
CN Lab Manual
PDF
No ratings yet
CN Lab Manual
21 pages
cn record (1)
PDF
No ratings yet
cn record (1)
25 pages
CN Lab Manual
PDF
No ratings yet
CN Lab Manual
109 pages
1a) Implement The Data Link Layer Framing Bit Stuffing Method
PDF
No ratings yet
1a) Implement The Data Link Layer Framing Bit Stuffing Method
19 pages
Computer Networks Algorithms in C Language
PDF
63% (8)
Computer Networks Algorithms in C Language
20 pages
PART-B MANUALh
PDF
No ratings yet
PART-B MANUALh
14 pages
MCom (IS) - DCN LAB Programs
PDF
No ratings yet
MCom (IS) - DCN LAB Programs
16 pages
Computer Networks Labs Executable Progs: Prog 1 CRC
PDF
No ratings yet
Computer Networks Labs Executable Progs: Prog 1 CRC
15 pages
Computer Networks Record To Print
PDF
No ratings yet
Computer Networks Record To Print
47 pages
Azdocuments
PDF
No ratings yet
Azdocuments
23 pages
Computer Networks Record: Pojit
PDF
No ratings yet
Computer Networks Record: Pojit
10 pages
CN Lab Part B Exp 1 and 2
PDF
No ratings yet
CN Lab Part B Exp 1 and 2
11 pages
B. Prashanth - CN Lab Manual (R22).Docx (2) (1)
PDF
No ratings yet
B. Prashanth - CN Lab Manual (R22).Docx (2) (1)
43 pages
cn internals
PDF
No ratings yet
cn internals
13 pages
CN Manual
PDF
No ratings yet
CN Manual
33 pages
Laboratory Manual: Data Communication and Computer Networks
PDF
No ratings yet
Laboratory Manual: Data Communication and Computer Networks
33 pages
CN Practical File
PDF
No ratings yet
CN Practical File
16 pages
CN
PDF
No ratings yet
CN
1 page
cn manual
PDF
No ratings yet
cn manual
21 pages
Program 7 To 12 CN Lab With Outputs
PDF
No ratings yet
Program 7 To 12 CN Lab With Outputs
21 pages
Network Lab Programs For 7th Sem Vtu
PDF
No ratings yet
Network Lab Programs For 7th Sem Vtu
40 pages
CN Lab Manual
PDF
No ratings yet
CN Lab Manual
41 pages
Computer Network Lab Manual 2024
PDF
No ratings yet
Computer Network Lab Manual 2024
11 pages
Part-A: 1. Write A Program To Implement RSA Algorithm
PDF
No ratings yet
Part-A: 1. Write A Program To Implement RSA Algorithm
49 pages
CNS Lab Manual For End Sem Exam
PDF
No ratings yet
CNS Lab Manual For End Sem Exam
28 pages
COMPUTER NETWORKS LAB
PDF
No ratings yet
COMPUTER NETWORKS LAB
70 pages
CCN - Part-B Programs
PDF
No ratings yet
CCN - Part-B Programs
11 pages
CN Lab Internal
PDF
No ratings yet
CN Lab Internal
17 pages
4 To 13 CN
PDF
No ratings yet
4 To 13 CN
33 pages
Alpha
PDF
No ratings yet
Alpha
2 pages
CN_lab
PDF
No ratings yet
CN_lab
12 pages
Network Communication - Embedded Lab Inlab Exam Lab Code: L41+L42 Name: Sannithi Sai Lokesh Reg No: 19bce2379
PDF
No ratings yet
Network Communication - Embedded Lab Inlab Exam Lab Code: L41+L42 Name: Sannithi Sai Lokesh Reg No: 19bce2379
8 pages
VCNLB 2023
PDF
No ratings yet
VCNLB 2023
14 pages
CN Lab CSE-CS!_merged
PDF
No ratings yet
CN Lab CSE-CS!_merged
3 pages
CCN Lab Manual
PDF
No ratings yet
CCN Lab Manual
50 pages
Lab Manual in CN Lab 2021
PDF
No ratings yet
Lab Manual in CN Lab 2021
42 pages
Computer Engineering Laboratory Solution Primer
From Everand
Computer Engineering Laboratory Solution Primer
Karan Bhandari
No ratings yet
150+ C Pattern Programs
From Everand
150+ C Pattern Programs
Hernando Abella
No ratings yet
MODULE 4 and 5 CCD
PDF
No ratings yet
MODULE 4 and 5 CCD
5 pages
BB - 13 Conference Paper
PDF
No ratings yet
BB - 13 Conference Paper
1 page
Mefa Unit 5
PDF
No ratings yet
Mefa Unit 5
32 pages
Mefa Unit 3
PDF
No ratings yet
Mefa Unit 3
39 pages
Mod-4 Problems
PDF
No ratings yet
Mod-4 Problems
4 pages
Module 5
PDF
No ratings yet
Module 5
34 pages
CCNA 2 v6.0 Final Exam Answers 2018 - Routing & Switching Essentials-42-45 PDF
PDF
No ratings yet
CCNA 2 v6.0 Final Exam Answers 2018 - Routing & Switching Essentials-42-45 PDF
4 pages
Computer Fundamentals by Dr. S Srivastava..
PDF
0% (2)
Computer Fundamentals by Dr. S Srivastava..
44 pages
VSP Data Interpretation and Processing PDF
PDF
No ratings yet
VSP Data Interpretation and Processing PDF
214 pages
E-Commerce Architecture
PDF
No ratings yet
E-Commerce Architecture
7 pages
Islp 2
PDF
No ratings yet
Islp 2
6 pages
BOCW English
PDF
No ratings yet
BOCW English
1 page
UNAVI Install 2016 Optima
PDF
No ratings yet
UNAVI Install 2016 Optima
32 pages
Building A Talking AI With LLAMA + RAG - by Stefanoz - Oct, 2024 - Medium
PDF
No ratings yet
Building A Talking AI With LLAMA + RAG - by Stefanoz - Oct, 2024 - Medium
23 pages
SAP-System Applications and Products
PDF
No ratings yet
SAP-System Applications and Products
146 pages
Incoming Inspection Procedure: Document Part No. Rev 100-0044 007 1 of 11
PDF
100% (1)
Incoming Inspection Procedure: Document Part No. Rev 100-0044 007 1 of 11
11 pages
22MCA1008 - Varun ML LAB ASSIGNMENTS
PDF
100% (1)
22MCA1008 - Varun ML LAB ASSIGNMENTS
41 pages
Streaming Tag Implementaticomscore On Scenarios
PDF
No ratings yet
Streaming Tag Implementaticomscore On Scenarios
1 page
Chapter 4 Descriptive Data Mining
PDF
No ratings yet
Chapter 4 Descriptive Data Mining
6 pages
Development of A Web-Based Clean and Healthy Life Behavior Monitoring System
PDF
No ratings yet
Development of A Web-Based Clean and Healthy Life Behavior Monitoring System
6 pages
Cooper Electronic
PDF
100% (1)
Cooper Electronic
128 pages
BCA Syllabus Sem-V
PDF
No ratings yet
BCA Syllabus Sem-V
11 pages
My AIA App Guide Nov
PDF
100% (1)
My AIA App Guide Nov
41 pages
Impatt Diode
PDF
No ratings yet
Impatt Diode
15 pages
CS 601 Machine Learning Unit 5
PDF
No ratings yet
CS 601 Machine Learning Unit 5
18 pages
Stress and Volume
PDF
No ratings yet
Stress and Volume
2 pages
Corporate Legal Framework
PDF
No ratings yet
Corporate Legal Framework
43 pages
Paytm Ola Ongo Mobikw Ik Redbus Quick Wallet Oxigen Shoppers Stop Pockets Payu Jabong ITZ Cash SBI Uts
PDF
No ratings yet
Paytm Ola Ongo Mobikw Ik Redbus Quick Wallet Oxigen Shoppers Stop Pockets Payu Jabong ITZ Cash SBI Uts
4 pages
RS485 NPK
PDF
No ratings yet
RS485 NPK
13 pages
Alarm Clock MANUAL
PDF
No ratings yet
Alarm Clock MANUAL
15 pages
HC110110011 VRP Operating System Image Management
PDF
No ratings yet
HC110110011 VRP Operating System Image Management
14 pages
(November-2019) Braindump2go New AWS-Certified-Solutions-Architect-Associate PDF Dumps Free Share PDF
PDF
No ratings yet
(November-2019) Braindump2go New AWS-Certified-Solutions-Architect-Associate PDF Dumps Free Share PDF
5 pages
Primia Addex B2B Gifts
PDF
No ratings yet
Primia Addex B2B Gifts
124 pages
ITR 1 Schema Change Document AY2024-25 V1.2
PDF
No ratings yet
ITR 1 Schema Change Document AY2024-25 V1.2
5 pages