Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What would be the algorithm for the following C code? Can I just get pseudocode, please? int * FIFOAlgorithm( int n, int *a, int number)

What would be the algorithm for the following C code? Can I just get pseudocode, please?

int* FIFOAlgorithm(int n, int *a, int number) { int i,j,k,frame[number],available,pageFault=0; static int PageFaultcount[] = {0,0,0,0,0}; for(i=0;ifor(i=1;i<=n;i++) { if(i%2000 == 0) { PageFaultcount[((i/2000)-1)] = pageFault; // printf(" FIFO : %d = %d", i, pageFault);  } available=0; for(k=0;kif(frame[k]==a[i]) available=1; if (available==0){ frame[j]=a[i]; j=(j+1)%number; pageFault++; } } //printf(" FIFO : Total no of page faults %d",pageFault);  return PageFaultcount; } int isHit(int data, int nf, int *p) { int hit=0,j; for( j=0; jif(p[j]==data) { hit=1; break; } } return hit; } int getHitIndex(int data, int nf, int *p) { int hitindex; int k; for( k=0; kif(p[k]==data) { hitindex=k; break; } } return hitindex; } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago