1 / 6

Randomized “Algorithms”

Randomized “Algorithms”. Monte Carlo and Las Vegas Technuques. Randomized. Monte Carlo Might give an incorrect answer (approximate) but always give an answer Las Vegas Might never give an answer (quit or run forever) Each uses some randomized technique to attack a problem.

iria
Download Presentation

Randomized “Algorithms”

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. Randomized “Algorithms” Monte Carlo and Las Vegas Technuques

  2. Randomized • Monte Carlo • Might give an incorrect answer (approximate) but always give an answer • Las Vegas • Might never give an answer (quit or run forever) • Each uses some randomized technique to attack a problem

  3. Monte Carlo Integration float area(function f, float a, float b, float fMax, int n) { float x, y; int hits=0, trial; for (trial=0; trial<n; trial++) { x = a+random(b-a); y = random(fMax); if (f(x)>=y) hits++; } return((b-a)*fMax*hits/n); }

  4. Las Vegas and Ethernet bool success = false; while (!success) { status = message.send(); success = status == TRANSMITTED; if (!success) wait a bit; }

  5. Las Vegas Dining Philosophers • Discussed in class Monte Carlo Illumination • Discussed in class

  6. References • Some material from the textbook: Data Structures and Algorithm Analysis in Java (Second Edition) by Mark Allen Weiss • Additional images: www.wikipedia.com

More Related