1 / 10

Queue

Discussion H. Queue. Queue with Stacks. A B C D. D C B. B C D. A. D C B A. Stacks with Queues. A B C D. D. A B C. A B C D. A B C. Web Browser Cache (1). public class Browser { private Cache cache; public Browser (String homepage) { view(homepage); }

Download Presentation

Queue

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Discussion H Queue

  2. Queue with Stacks A B C D D C B B C D A D C B A

  3. Stacks with Queues A B C D D A B C A B C D A B C

  4. Web Browser Cache (1) public class Browser { private Cache cache; public Browser (String homepage) { view(homepage); } public view (String pageurl) { Page p = cache.getCached(pageurl); if (p == null) { Page p = new Page(pageurl); cache.updateCache(pageurl); } view(p); } public void view(Page p) {} }

  5. Web Browser Cache (2) public class Cache { private Queue<Page> cashed; private int limit; public Cache (int limit) { cached = new Queue<Page>(); this.limit = limit; } public boolean isCached (String url) { } public Page getCached (String url) { } public void updateCache(Page p) { } }

  6. Web Browser Cache (3) public class Cache { private Queue<Page> current, other, qa, qb; private int limit; public Cache (int limit) { qa = new Queue<Page>(); qb = new Queue<Page>(); current = qa; other = qb; this.limit = limit; } }

  7. Web Server Request Buffer (1) public class WebServer { private Queue<Request> requests; public Server () { requests = new Queue<Request>(); } public void receive (Request r) { } public void reply() {} public void run() {} }

  8. Web Server Request Buffer (2) public void receive (Request r) { requests.offer(r); } public void reply() { Requests r = requests.get(); .... }

  9. DeQue A B C D D X A B C D X A B C A B C D Remove from End Insert At begining

  10. Virtual Memory Manager Pages: A B C D E F hit a b c f d f b c a full B C D A B C F B C D B C F D F F

More Related