Indexed File Allocation Program in C

Indexed File Allocation Program in C #include <stdio.h> #include <conio.h> #include <stdlib.h> int files[50], indexBlock[50], indBlock, n; void recurse1(); void recurse2(); void recurse1(){ printf("Enter the index block: "); scanf("%d", &indBlock);…

0 Comments

Lexical Analyzer in C

In this article, I am going to share the C Program for Lexical Analyzer. Okay, let's move on to the tutorial. C Program for Lexical Analyzer #include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h>…

0 Comments

Prim’s Algorithm in C

Prim’s Algorithm in C #include<stdio.h> #include<stdlib.h> #define infinity 9999 #define MAX 20 int G[MAX][MAX],spanning[MAX][MAX],n; int prims(); int main() { int i,j,total_cost; printf("Enter no. of vertices:"); scanf("%d",&n); printf("\nEnter the adjacency matrix:\n");…

0 Comments

Breadth First Search (BFS) Program in C

Breadth First Search (BFS) Program in C #include<stdio.h> #include<stdlib.h> #define MAX 100 #define initial 1 #define waiting 2 #define visited 3 int n; int adj[MAX][MAX]; int state[MAX]; void create_graph(); void…

0 Comments

Producer Consumer Problem in C

Producer Consumer Problem in C #include<stdio.h> #include<stdlib.h> int mutex=1,full=0,empty=3,x=0; int main() { int n; void producer(); void consumer(); int wait(int); int signal(int); printf("\n1.Producer\n2.Consumer\n3.Exit"); while(1) { printf("\nEnter your choice:"); scanf("%d",&n); switch(n)…

0 Comments

Banker’s Algorithm in C

C Program for Banker’s Algorithm #include <stdio.h> int current[5][5], maximum_claim[5][5], available[5]; int allocation[5] = {0, 0, 0, 0, 0}; int maxres[5], running[5], safe = 0; int counter = 0, i,…

0 Comments

Binary Search Tree in C

Binary Search Tree in C #include<stdio.h> #include<stdlib.h> typedef struct BST { int data; struct BST *left; struct BST *right; }node; node *create(); void insert(node *,node *); void preorder(node *); int…

0 Comments

C Program for Shortest Job First (SJF) Scheduling Algorithm

C Program for Shortest Job First (SJF) Scheduling Algorithm #include<stdio.h> void main() { int bt[20],p[20],wt[20],tat[20],i,j,n,total=0,pos,temp; float avg_wt,avg_tat; printf("Enter number of process:"); scanf("%d",&n); printf("\nEnter Burst Time:\n"); for(i=0;i<n;i++) { printf("p%d:",i+1); scanf("%d",&bt[i]); p[i]=i+1;…

0 Comments