Clothing and shelter ppt

374 141 0
Clothing and shelter ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Algorithms Department of Computer Science University of Illinois at Urbana-Champaign Instructor: Jeff Erickson Teaching Assistants: • Spring 1999: Mitch Harris and Shripad Thite • Summer 1999 (IMCS): Mitch Harris • Summer 2000 (IMCS): Mitch Harris • Fall 2000: Chris Neihengen, Ekta Manaktala, and Nick Hurlburt • Spring 2001: Brian Ensink, Chris Neihengen, and Nick Hurlburt • Summer 2001 (I2CS): Asha Seetharam and Dan Bullok • Fall 2002: Erin Wolf, Gio Kao, Kevin Small, Michael Bond, Rishi Talreja, Rob McCann, and Yasutaka Furakawa • Spring 2004: Dan Cranston, Johnathon Fischer, Kevin Milans, and Lan Chen • Fall 2005: Erin Chambers, Igor Gammer, and Aditya Ramani • Fall 2006: Dan Cranston, Nitish Korula, and Kevin Milans • Spring 2007: Kevin Milans • Fall 2008: Reza Zamani-Nasab • Spring 2009: Alina Ene, Ben Moseley, and Amir Nayyeri • Spring 2010: David Morrison, Kyle Fox, and Rachit Agarwal • Fall 2010: Alina Ene c Copyright 1999–2011 Jeff Erickson. Last update July 8, 2011. This work may be freely copied and distributed, either electronically or on paper. It may not be sold for more than the actual cost of reproduction, storage, or transmittal. This work is licensed under a Creative Commons Attribution-NonCommercial-Share Alike 3.0 United States License. For license details, see http://creativecommons.org/licenses/by-nc-sa/3.0/us/. For the most recent edition of this work, see http://www.cs.illinois.edu/~jeffe/teaching/algorithms/. [...]... are n doctors and n hospitals; each hospital offers exactly one internship; each doctor ranks all hospitals and vice versa; and finally, there are no ties in the doctors’ and hospitals’ rankings.12 We say that a matching of doctors to hospitals is unstable if there are two doctors α and β and two hospitals A and B, such that • α is assigned to A, and β is assigned to B; • α prefers B to A, and B prefers... want the reader to look at On the other hand, I use italics for variables, SMALL CAPS for algorithms and constants, and a different typeface for literal strings and comments 0.4 Analyzing algorithms It’s not enough just to write down an algorithm and say ‘Behold!’ We also need to convince ourselves (and our graders) that the algorithm does what it’s supposed to do, and that it does it efficiently Correctness... attributed to David Gale and Lloyd Shapley, who formally analyzed the algorithm and first proved that it computes a stable matching in 1962; Gale and Shapley used the metaphor of college admissions.13 Similar algorithms have since been adopted for other matching markets, including faculty recruiting in France, university admission in Germany, public school admission in New York and Boston, and billet assignments... algorithm requires at most n2 rounds In an actual implementation, each doctor and hospital can be identified by a unique integer between 1 and n, and the preference lists can be represented as two arrays DocPref[1 n][1 n] and HosPref[1 n][1 n], where DocPref[α][r] represents the rth hospital in doctor α’s preference list, and HosPref[A][r] represents the rth doctor in hospital A’s preference list With... each a cubit high and as thick as the body of a bee On one of these needles, at the creation, God placed sixty-four discs of pure gold, the largest disc resting on the brass plate, and the others getting smaller and smaller up to the top one This is the Tower of Bramah Day and night unceasingly the priests transfer the discs from one diamond needle to another according to the fixed and immutable laws... Introduction [F10] Algorithms • Be consistent! • Use standard imperative programming keywords (if/then/else, while, for, repeat/until, case, return) and notation (variable ← value, Array[index], function(argument), bigger > smaller, etc.) Keywords should be standard English words: write ‘else if’ instead of ‘elif’ • Indent everything carefully and consistently; the block structure should be visible... pseudocode is a personal choice, but the overriding goal should be clarity and precision Ideally, pseudocode should allow any competent programmer to implement the underlying algorithm, quickly and correctly, in their favorite programming language, without understanding why the algorithm works Here are the guidelines I follow and strongly recommend: 9 This is, of course, a matter of religious conviction... assignment but prefers A, she rejects her existing assignment and (tentatively) accepts the new offer from A Otherwise, α rejects the new offer For example, suppose four doctors (Dr Quincy, Dr Rotwang, Dr Shephard, and Dr Tam, represented by lower-case letters) and four hospitals (Arkham Asylum, Bethlem Royal Hospital, County General Hospital, and The Dharma Initiative, represented by upper-case letters)... array) gives us N = Θ(1) and I = R = O(log n), which implies an overall running time of O(R log n) Sometimes we are also interested in other computational resources: space, randomness, page faults, inter-process messages, and so forth We can use the same techniques to analyze those resources as we use to analyze running time 0.5 A Longer Example: Stable Matching Every year, thousands of new doctors must... input and a sequence of Ω(n2 ) valid proposals.) 4 Describe and analyze an efficient algorithm to determine whether a given set of hospital and doctor preferences has to a unique stable matching 5 Consider a generalization of the stable matching problem, where some doctors do not rank all hospitals and some hospitals do not rank all doctors, and a doctor can be assigned to a hospital only if each appears . bugs.) Acknowledgments The lecture notes and exercises draw heavily on the creativity, wisdom, and experience of thousands of algorithms students, teachers, and researchers. In. Bixby and Michael Perlman at Rice; David Eppstein, Dan Hirshberg, and George Lueker at UC Irvine; and Abhiram Ranade, Dick Karp, Manuel Blum, Mike Luby, and

Ngày đăng: 23/03/2014, 00:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan