id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

frew@mclean.com disco > fifo
prev  |  next  |  chance

Write a method that accepts 2 parameters: the number of page slots available, and the list of pages accessed in order, that returns the number of page faults using FIFO. Make sure to use an ArrayList to manage your page slots.


fifo(4, [7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2]) → 7
fifo(3, [1, 2, 1, 0, 3, 0, 4, 2, 4]) → 6
fifo(3, [1, 3, 0, 3, 5, 6, 3]) → 6

...Save, Compile, Run (ctrl-enter)

public int fifo(int numPages, int[] pagesAccessed) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy