Skip to main content

Posts

Priority process scheduling algorithm in C Programming

#include #include void main() { int njob,pID[15],aTime[15],bTime[15],jcTime[15],taTime[15],wTime[15],i,j,temp,sTime[15],prior[15]; float totalWait,totalTA; clrscr(); printf("\n Enter number of process:"); scanf("%d",&njob); for(i=0;i prior[j]) { temp=pID[i]; pID[i]=pID[j]; pID[j]=temp; temp=aTime[i]; aTime[i]=aTime[j]; aTime[j]=temp; temp=bTime[i]; bTime[i]=bTime[j]; bTime[j]=temp; temp=prior[i]; prior[i]=prior[j]; prior[j]=temp; } } } for(i=0;i OUTPUT Enter number of process:5 Enter the Arrival time , Burst time and Priority for process[1]:0 10 3 Enter the Arrival time , Burst time and Priority for process[2]:0 6 5 Enter the Arrival time , Burst time and Priority for process[3]:0 2 2 Enter the Arrival time , Burst time and Priority for process[4]:0 4 1 Enter the Arrival time , Burst time and Priority for process[5]:0 8 4 Process ArrivalTime BurstTime Priority Turnarou...

Shortest Job First (SJF) process scheduling algorithm in C Programming

#include #include void main() { int njob,pID[15],aTime[15],bTime[15],jcTime[15],taTime[15],wTime[15],i,j,temp,sTime[15]; float totalWait,totalTA; clrscr(); printf("\n Enter number of process:"); scanf("%d",&njob); for(i=0;i bTime[j]) { temp=pID[i]; pID[i]=pID[j]; pID[j]=temp; temp=aTime[i]; aTime[i]=aTime[j]; aTime[j]=temp; temp=bTime[i]; bTime[i]=bTime[j]; bTime[j]=temp; } } } for(i=0;i OUTPUT Enter number of process:5 Enter the Arrival time & Burst time for process[1]:0 9 Enter the Arrival time & Burst time for process[2]:1 5 Enter the Arrival time & Burst time for process[3]:2 2 Enter the Arrival time & Burst time for process[4]:3 6 Enter the Arrival time & Burst time for process[5]:4 8 Process ArrivalTime BurstTime TurnaroundTime WaitingTime _+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+ 3 2 2 2 ...

First Come First Serve (FCFS) process scheduling algorithm in C Programming

#include #include int fsize; int frm[15]; void display(); void main() { int pg[100],nPage,i,j,pf=0,top=-1,temp,flag=0; clrscr(); printf("\n Enter frame size:"); scanf("%d",&fsize); printf("\n Enter number of pages:"); scanf("%d",&nPage); for(i=0;i OUTPUT Enter the number of processes:5 Enter the Arrival Time & Burst Time for process[1]:0 9 Enter the Arrival Time & Burst Time for process[2]:1 5 Enter the Arrival Time & Burst Time for process[3]:2 2 Enter the Arrival Time & Burst Time for process[4]:3 6 Enter the Arrival Time & Burst Time for process[5]:4 8 PId ArrivalTime BurstTime JCTime WaitingTime TAtime _+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+ 1 0 9 9 0 9 2 1 5 14 8 13 3 2 2 16 12 14 4 3 6 22 ...

GATE 2014 syllabus for CS & IT

Syllabus for Computer Science and Information Technology (CS) ENGINEERING MATHEMATICS Mathematical Logic :  Propositional Logic; First Order Logic. Probability :  Conditional Probability; Mean, Median, Mode and Standard Deviation; Random Variables; Distributions; uniform, normal, exponential, Poisson, Binomial. Set Theory & Algebra :  Sets; Relations; Functions; Groups; Partial Orders; Lattice; Boolean Algebra. Combinatory :  Permutations; Combinations; Counting; Summation; generating functions; recurrence relations; asymptotics. Graph Theory :  Connectivity; spanning trees; Cut vertices & edges; covering; matching; independent sets; Colouring; Planarity; Isomorphism. Linear Algebra :  Algebra of matrices, determinants, systems of linear equations, Eigen values and Eigen vectors. Numerical Methods :  LU decomposition for systems of linear equations; numerical solutions of non-linear algebraic equations by Secant, Bisection and...

GCD of two number using euclidean algorithm in Java

//File Name: GCDExample.java import java.util.*; public class GCDExample { public static void main(String args[]){ //Enter two number whose GCD needs to be calculated. Scanner scanner = new Scanner(System.in); System.out.println("Please enter first number to find GCD"); int number1 = scanner.nextInt(); System.out.println("Please enter second number to find GCD"); int number2 = scanner.nextInt(); System.out.println("GCD of two numbers " + number1 +" and " + number2 +" is :" + findGCD(number1,number2)); } /* * Java method to find GCD of two number using Euclid's method * @return GDC of two numbers in Java */ private static int findGCD(int number1, int number2) { //base case if(number2 == 0){ return number1; } return findGCD(number2, number1%number2...

Implementation One time pad cipher in Java

// File Name: OneTimePad.java import java.util.*; class msg{ int a=97; char all[]=new char[27]; msg() { for(int i=0;i 26) ct[i]=ct[i]%26; } String cipher=""; for(int i=0;i OUTPUT Enter plaintext: onetimepadalogrihtmsneedlongkey Enter key: longkeyisrequiredforonetimepad Encrpted text is:zbrzsqcxsuebioimky jbriwt rvkhj Decrypted text is:onetimepadalogrihtmsneedlongkey

Implementation of Playfair cipher in Java

//File Name: PlayFairCipher.java import java.util.*; class Basic{ String allChar="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; boolean indexOfChar(char c) { for(int i=0;i 4) { b=0; a++; } } } char p='A'; while(a 4) r1=0; if(r2>4) r2=0; cipherChar+=keyMatrix[r1][c2]; cipherChar+=keyMatrix[r2][c1]; } else if(r1==r2) { ++c1; ++c2; if(c1>4) c1=0; if(c2>4) c2=0; cipherChar+=keyMatrix[r1][c1]; cipherChar+=keyMatrix[r2][c2]; } else{ cipherChar+=keyMatrix[r1][c2];...