Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int x;
- x = calculateConvergence();
- while (x == 1) {
- int i;
- struct page *examplePage;
- for (i=0; i<noPages; i++) {
- //get page
- examplePage = &pageArray[i];
- //get first in page.
- struct page *inPage;
- struct node *currNode;
- currNode = examplePage->inPagesBase;
- int noOfOuts, z;
- float prevPValue;
- float sumOfInPages = 0;
- for(z=0; z<noPages; z++) {
- if (currNode = NULL) {
- break;
- }
- else {
- //get page
- inPage = currNode->page;
- //get prev p value
- prevPValue = inPage->currentPValue;
- //get nmber of outs
- noOfOuts = inPage->noOutPages;
- //perform caluclation p(n-1)INPAGE/noOfOuts
- sumOfInPages = sumOfInPages + (prevPValue/noOfOuts);
- //move to next node
- if (currNode->nextNode == NULL) {
- break;
- }
- else {
- currNode = currNode->nextNode;
- }
- }
- }
- float sumOfInPagesTimesD;
- sumOfInPagesTimesD = D*sumOfInPages;
- float firstHalf;
- firstHalf = ((1-D)/noPages);
- float totalPValue = firstHalf + sumOfInPagesTimesD;
- //set in struct
- examplePage->previousPValue = examplePage->currentPValue;
- examplePage->currentPValue = totalPValue;
- }
- // x = calculateConvergence();
- }
- return 1;
Add Comment
Please, Sign In to add comment