Advanced programs

Least Recently Used Paging Algorithm

Least Recently Used Paging Algorithm 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 […]


C Program to convert Prefix Expression into INFIX

C Program to convert Prefix Expression into INFIX. Source: Dr. G T Raju, Professor & Head, Dept. of CSE, RNSIT 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 […]


C Program which performs stack operations

Following program performs various stack operations, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 […]


Binary Search

A binarysearch program locates the position of an item in a sorted array. Logic: The Binary search starts by testing the element at the middle of the array. Let us consider an array ‘a’ with all elements arranged in ascending order. Let low and high are the lower and upper indices of the array ‘a’, respectively. We want to search an item […]


C program to implement tower of Hanoi problem

To implement tower of Hanoi problem. #include<stdio.h> void hanoi_tower(char,char,char,int); void hanoi_tower(char peg1,char peg2,char pege3,int n) { if(n<=0) printf("\n Illegal Entry"); if(n==1) printf ("\n Move disk from %c to %c", pege1,pege3); else { hanoi_tower(peg1,peg3,peg2,n-1); hanoi_tower(peg1,peg2,peg3,1); hanoi_tower(peg2,peg1,peg3,n-1); } } Void main () { int n; printf("\n Input the number of dise:); scanf("%d", &n); printf("\n Tower of Hanoi […]


C program to Implement Morse code to text conversion and vice-versa.

C program to Implement Morse code to text conversion and vice-versa. #include<stdio.h> #include<conio.h> #include<string.h> #include<process.h>   void main() { char str[25],str1[100]; clrscr(); fflush(stdin); printf("enter the String"); gets(str);   int j=0; for(int i=0;i<=strlen(str);++) { switch(toupper(str[i])) { case ‘A’: str1[j++]=’.’; str1[j]=’.’; break;   case ‘b’: str1[j++]=’.’; str1[j++]=’.’; str1[j++]=’.’; str1[j]=’.’; break;   case ‘c’: str1[j++]=’.’; str1[j++]=’.’; str1[j++]=’.’; str1[j]=’.’; […]


C program for Syntax Analyzer

C program for Syntax Analyzer #include<stdio.h> #include<conio.h> #include<string.h> #include<ctype.h> void main() { int i,j,k=0,count,inc=0,n; char name[30],open[30],ch,chh,o[30]; char op[20]={’=’,’+’,’-‘,’*’,’/’,’%’,’^’,’&’,’|’}; clrscr(); textcolor(3); cprintf("–Syntax Analyser–"); printf("\n"); printf("\n Enter Syntax"); printf("\n"); scanf("%s",name); n=strlen(name); for(i=0;i<n;i++) { ch=tolower(name[i]); for(j=0;j<9;j++) { if(ch==op[j]) { open[k]=i; o[k]=ch; k++; } } } for(i=0;i<k;i++) { count=open[i]; ch=tolower(name[count-1]); chh=tolower(name[count+1]); if(isalpha(ch)&&isalpha(chh)||isdigit(chh)) ++inc; } if(k==inc) printf("\n %s is a […]