First general-purpose computers pot

374 167 0
First general-purpose computers pot

Đ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/. [...]... discovered by Dubins and Freeman in 1981, is that a doctor can potentially improve her assignment by lying about her preferences, but a hospital cannot (However, a set of hospitals can collude so that some of their assignments improve.) Partly for this reason, the National Residency Matching Program reversed its matching algorithm in 1998, so that potential residents offer to work for hospitals in preference... Barley Mow” has the following pseudolyrics, where container[i] is the name of a container that holds 2i ounces of beer One version of the song uses the following containers: nipperkin, gill pot, half-pint, pint, quart, pottle, gallon, half-anker, anker, firkin, half-barrel, barrel, hogshead, pipe, well, river, and ocean (Every container in this list is twice as big as its predecessor, except that a firkin... subarrays—either A[i + 1 m] and A[ j n], or A[i m] and A[ j + 1 n]—are merged correctly into B[k + 1 n] by the inductive hypothesis.4 This completes the proof Now we can prove MERGESORT correct by another round of straightforward induction The base cases n ≤ 1 are trivial Otherwise, by the inductive hypothesis, the two smaller subarrays A[1 m] and A[m + 1 n] are sorted correctly, and by our earlier argument, merged... transformation First we overestimate the time bound, once by pretending that the two subproblem sizes are equal, and again to eliminate the ceiling: T (n) ≤ 2T n/2 + O(n) ≤ 2T (n/2 + 1) + O(n) Now we define a new function S(n) = T (n + α), where α is a constant chosen so that S(n) satisfies the familiar recurrence S(n) ≤ 2S(n/2)+O(n) To figure out the appropriate value for α, we compare 4 “The inductive hypothesis”... understanding why the algorithm works Here are the guidelines I follow and strongly recommend: 9 This is, of course, a matter of religious conviction Linguists argue incessantly over the Sapir-Whorf hypothesis, which states (more or less) that people think only in the categories imposed by their languages According to an extreme formulation of this principle, some concepts in one language simply cannot... Lecture 1: Recursion [Fa’10] Algorithms recursion recursion The Tower of Hanoi algorithm; ignore everything but the bottom disk The base case for the Tower of Hanoi algorithm There is no spoon inductive hypothesis implies that our algorithm correctly moves) the top n − 1 disks, so our algorithm is clearly correct Here’s the recursive Hanoi algorithm in more typical pseudocode HANOI(n, src, dst, tmp): if... rejection implies that α prefers B to A 10 Lecture 0: Introduction [F10] Algorithms Every doctor that appears higher than α in B’s preference list has already rejected B and therefore, by the inductive hypothesis, is infeasible for B Now consider an arbitrary matching that assigns α to A We already established that α prefers B to A If B prefers α to its partner, the matching is unstable On the other hand,... Martin’s algorithm, like many of our previous examples, is not the kind of algorithm that computer scientists are used to thinking about, because it is phrased in terms of operations that are difficult for computers to perform In this class, we’ll focus (almost!) exclusively on algorithms that can be reasonably implemented on a computer In other words, each step in the algorithm must be something that either... crowned Pope Gregory IX excommunicated Frederick II, making the local priests less sympathetic to hosting foreign heretics with strange mathematical habits Soon afterward, a bell tower was erected on the spot where the temple once stood; it too began to lean almost immediately The Towers of Pisa In the fifth move, two disks are taken off the leaning needle Describe an algorithm to transfer a stack of n disks . 2 i ounces of beer. One version of the song uses the following containers: nipperkin, gill pot, half-pint, pint, quart, pottle, gallon, half-anker, anker, firkin, half-barrel, barrel, hogshead, pipe, well,. calculations. People trained in the reliable execution of these methods were called—you guessed it computers. 0.2 A Few Simple Examples Multiplication by compass and straightedge Although they have. Eastern Europe in the late 20th century. This algorithm was also commonly used by early digital computers that did not implement integer multiplication directly in hardware. PEASANTMULTIPLY(x,

Ngày đăng: 29/03/2014, 16:20

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

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

Tài liệu liên quan