# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

3 Pages

### prelim2spring2007ans

Course: CS 1110, Fall 2009
School: Cornell
Rating:

Word Count: 324

#### Document Preview

100J CS Prelim 2 Spring 2007 Answers Question 1. (a) A loop invariant is a true-false statement that is true before and after each iteration of the loop. (b) int m= f(0); // invariant: m = maximum value of f(i) for i in the range 0..k1 for (int k= 1; k &lt; n; k= k+1) { m= Math.max(m, f(k)); } Question 2. /** Pts in v[0..k-1] with negative x-y-coords have been replaced by corres. pts with positive x-y-coords....

Register Now

#### Unformatted Document Excerpt

Coursehero >> New York >> Cornell >> CS 1110

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
100J CS Prelim 2 Spring 2007 Answers Question 1. (a) A loop invariant is a true-false statement that is true before and after each iteration of the loop. (b) int m= f(0); // invariant: m = maximum value of f(i) for i in the range 0..k1 for (int k= 1; k < n; k= k+1) { m= Math.max(m, f(k)); } Question 2. /** Pts in v[0..k-1] with negative x-y-coords have been replaced by corres. pts with positive x-y-coords. */ for (int k= 0; k < v.size(); k= k+1) { if (v.get(k).getX() < 0 && v.get(k).getY() < 0){ int x= Math.abs(v.get(k).getX()); int y= Math.abs(v.get(k).getY()); v.set(k, new Point(x, y)); } } /** Pts in v[0..v.size()-1] with negative x-y-coords have been replaced by corres. pts with positive x-y-coords. */ Question 3. (a) The apparent type of a variable is the type or class with which it is declared; its real type is the type or class of the object whose name it contains. Variable v has apparent class Animal and real class AsianElephant. (c) (1) false, AsianElephant. (2) "Elephant", (3) Run- (b) /** = "obj is an with Elephant the same values in its fields as this Elephant" */ public boolean equals(Object obj) { if (!(obj instanceof Elephant)) return false; Elephant e= (Elephant) obj; return ht == e.ht && getName().equals(e.getName()) && getWeight() == e.getWeight(); } Question 5. /** = Rhino ra and rb are related */ public static boolean areRelated ( Rhino ra, Rhino rb) { if (ra == null || rb == null) return false; if (ra == rb) return true; // ra and rb are not null and are different return areRelated(ra, rb.mother) || areRelated(ra, rb.father) || areRelated(rb, ra.mother) || areRelated(rb, ra.father); } a0 Question 3...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Minnesota - CSCI - 5523
WEKA Explorer User Guide for Version 3-4Richard Kirkby Eibe Frank June 1, 2007c 2002-2007 University of WaikatoContents1 Launching WEKA 2 The WEKA Explorer Section Tabs . . . . . . Status Box . . . . . . . Log Button . . . . . . . WEKA Status I
Dallas - CS - 6378
A Distributed Mutual Exclusion AlgorithmICHIRO SUZUKI and TADAO KASAMI Osaka University, JapanA distributed algorithm is presented that realizes mutual exclusion among N nodes in a computer network. The algorithm requires at most N message exchang
CSU Northridge - MATH - 1051
W&quot; I P s \$ 7 &amp;\$ 7 G @ B @\$ Q B\$ 'mAeSAeP(F6vA%# U AIAS@ B\$ \$ &amp; G B\$ B @ 7 Q B B G @ B\$ @ Q\$ G &amp; B 7 \$ G 7 &amp;\$ U P(vI&quot;evVpxmb80Iep4P(VbA&quot;PAP()F8SI9(AeSAe7 )V i r u uw w w u n l wfy v XXWx
Purdue - LATEX - 209
% % % % %tape document style for LaTeX 2.09 podar@sbcs (Sunil Podar) June 20,1986 Dept. of Applied Math., SUNY at Stony Brook You may use this file for whatever purpose you wish. Please leave this notice, identifying original author, intact.\type
Ithaca College - PH - 174
Physics 174 Exercise 13Due 16 April Orbital Resonances9 April, 2007 Name: _ Table: _1. The Galilean Satellites Io, Europa, and Ganymede all show evidence of geologic activity (in the case of Io, it is pretty obvious). This activity has been tied
Drexel - MEM - 6025
DAQ6023E/6024E/6025E User ManualMultifunction I/O Devices for PCI, PXI , CompactPCI, and PCMCIA Bus Computers6023E/6024E/6025E User ManualDecember 2000 Edition Part Number 322072C-01Support Worldwide Technical Support and Product Information n
Wisconsin - ECON - 302
The Regional Economist april 2006nwww.stlouisfed.orgHow Dangerous Is the U.S. Current Account Deficit?By Cletus C. Coughlin, Michael R. Pakko and William Poolein recent years, the u.s. external deficit has attracted considerable attention fro
Dickinson State - I - 386
Sheet1 Novell Client Multiple Client Install Login Script 11/13/01 Important: Read this sample script in Notepad or WordPad to accommodate the log line lengths. PurposeIf you plan to install the Novell Client software on multiple workstations, you
Wayne State University - AM - 3429
A Reliable and Secure Connection Migration Mechanism for Mobile AgentsXiliang Zhong, Cheng-Zhong Xu, and Haiying Shen Department of Electrical &amp; Computer Engg. Wayne State University, Detroit, Michigan 48202 {xlzhong, czxu, shy}@wayne.edu AbstractC
SUNY Buffalo - BIO - 405
344ReviewTRENDS in Cell BiologyVol.13 No.7 July 2003Functional genomics and proteomics: charting a multidimensional map of the yeast cellqGary D. Bader1, Adrian Heilbut2, Brenda Andrews3, Mike Tyers3,4, Timothy Hughes3,5 and Charles Boone3,5
RIT - EECC - 550
CA P P E N D I XMapping Control to HardwareA custom format such as this is slave to the architecture of the hardware and the instruction set it serves. The format must strike a proper compromise between ROM size, ROM-output decoding, circuitry si
CSU Channel Islands - P - 113
Supplement14-AThe Hartree ApproximationThe energy eigenvalue problem for an atom with Z electrons has the formZ i 1p2 i 2meZe2 40ri i j j4e2 0 rirj(r1, r2, . . . , rZ) E (r1, r2, . . . , rZ)(14A-1)and is a partial differential
CSU Channel Islands - P - 113
Supplement2-AThe Fourier Integral and Delta FunctionsConsider a function f(x) that is periodic, with period 2L, so that f(x) f(x 2L) (2A-1)Such a function can be expanded in a Fourier series in the interval ( L, L), and the series has the form
CSU Channel Islands - P - 113
Supplement1-AEinsteins Approach to Plancks LawIn 1917 Albert Einstein wrote a remarkable paper in which he used classical statistical mechanics and elements of the old Bohr theory to derive the Planck distribution and to relate spontaneous emiss
Stanford - EE - 380
Systems and Technology GroupCell today and tomorrowH. Peter Hofstee, Ph. D. Cell Chief Scientist and Chief Architect, Cell Synergistic Processor IBM Systems and Technology Group SCEI/Sony Toshiba IBM (STI) Design Center Austin, Texas 2005 IBM Co
Penn State - STAT - 512
Statistics 512Final ExamSpring 2002Statistics 512 Final ExamApril 29 - May 1, 2002This is a take home exam. The following rules apply. 1. You may use any textbook, including textbooks on the Web. 2. You may use any statistical software. 3. A
Penn State - JKB - 207
Cornell - CS - 100
Explanations are often given in the comments. Read the comments carefully.Below are some important ideas for developing algoithms. They may make more sense after you read/try the review questions. I put them up front to makesure that you see th
Mich Tech - EE - 3301
Orcad Component Information System Quick ReferenceShortcut keys CIS toolbars Command mapping from CIS v7.20 to CIS Release 9Cadence PCB Systems Division (PSD) offices PSD main office (Portland) PSD Irvine office PSD Japan office PSD UK office PSD
University of Illinois, Urbana Champaign - ECE - 390
NetLib: NetBIOS Library Calls- John Lockwood, lockwood@ipoint.vlsi.uiuc.edu Department of Electrical and Computer Engineering University of Illinois at Urbana/Champaign Version 1.2, March 1999Purpose- General purpose ASM network librar
Washington - PHYS - 334
ASU - MAT - 274
F ggfY(zgg(@Y9 gfYic@Y( D 9 \$Y ( u y G z v y z E 7 5 q 4 o X f ! &quot;YiV (e {( f b S gyT f f(YPi f b S i ' k T ` ' gfYic@Y(@\$Y g u z v y z 97 5 q 4 h ` b T &quot; #! YWY3&quot;T iS dY(ig&quot;Pi f b S i ' C F C iciv g Y(g
ASU - MAT - 274
MAT 275Parachute WorksheetThe purpose of this worksheet is to discuss the rst order dierential equation k dv = g v (1) dt m Suppose the above equation describes the fall of a skydiver who jumps out of an airplane at the altitude of 2000m. Assume
ASU - CET - 459
CET 458/598Fall 2000Lecture NotesChapter 1 IntroductionSection 1.1 mostly terminology Connectivity, scale, link, node, point-to-point, multiple-access, switched network (circuit vs packet switched, similarities to telephone system and snail-ma
ASU - CET - 459
CET 458/598Graph TheoryFall 2000graph - a set of nodes (vertices) and a set of arcs (edge, link, line) connecting the nodes adjacent nodes - if an arc connects them directed or undirected arc - if information only flows in direction of arrow de
Alaska Anch - GEOL - 301
earth sciencethe Origin of theand L Under seatheThe deep basins under the oceans are carpeted with lava that spewed from submarine volcanoes and solidified. Scientists have solved the mystery of how, precisely, all that lava reaches the seaflo
CSU Northridge - MLM - 85331
Midwestern State University - EM - 4284
4-H LEADER GUIDECAT PHYSIOLOGYUNIT 3COOPERATIVE EXTENSIONEM4284CONTENTSLesson Questions 1: Introductory Lesson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2: Vision, Hearing, Respiratory System . . . . . . . . . . . . .
Washington University in St. Louis - CSE - 306
Gran's Guide to SVGA Programming(640 x 480 x 256 colors)-(For more information on all SVGA modes, see: http:/www.osha.igs.net/~dandelong/nw/index.htm)Due to the VESA standards, SVGA is pretty simple to do.The screen is setup as if it were mult
Washington University in St. Louis - CS - 577
CS/EE 577 - Homework 2Due 10/10/001. Derive the equations for the mean and variance of the geometric distribution, by applying the definitions given in the notes. Show that if x and y are geometric random variables with parameters p and q respecti
Penn State - SEF - 5013
Penn State - PUBS - 173
SERIES SUBSCRIPTION ORDER FORMOfficial Use OnlyReceived Initials SourceAccount Number (from mailing label) Name StreetSydn ey Danc e CoCitymp an y GRA NDState EveningZIPPhone: Day E-mailMay we add you to our marketing and commu
Penn State - SMK - 5085
Syracuse - PHY - 351
DAQ6023E/6024E/6025E User ManualMultifunction I/O Devices for PCI, PXI , CompactPCI, and PCMCIA Bus Computers6023E/6024E/6025E User ManualDecember 2000 Edition Part Number 322072C-01Support Worldwide Technical Support and Product Information n
U. Memphis - FIR - 7721
Determination of Forward and Futures PricesChapter 5Options, Futures, and Other Derivatives 6th Edition, Copyright John C. Hull 20055.1Consumption vs Investment Assets Investmentassets are assets held by significant numbers of people purel
U. Memphis - FIR - 7721
Interest RatesChapter 4Options, Futures, and Other Derivatives 6th Edition, Copyright John C. Hull 20054.1Types of Rates Treasuryrates LIBOR rates Repo ratesOptions, Futures, and Other Derivatives 6th Edition, Copyright John C. Hull 2
U. Memphis - FIR - 7721
Wiener Processes and It's LemmaChapter 12Options, Futures, and Other Derivatives, 6th Edition, Copyright John C. Hull 2005Types of Stochastic Processes Discretetime; discrete variable Discrete time; continuous variable Continuous time; dis
U. Memphis - FIR - 7721
Options on Stock Indices, Currencies, and FuturesChapter 14Options, Futures, and Other Derivatives, 6th Edition, Copyright John C. Hull 200514.1European Options on Stocks Providing a Dividend YieldWe get the same probability distribution for
U. Memphis - FIR - 7721
Hedging Strategies Using FuturesChapter 3Options, Futures, and Other Derivatives 6th Edition, Copyright John C. Hull 20053.1Long &amp; Short HedgesAlong futures hedge is appropriate when you know you will purchase an asset in the future and wa
U. Memphis - FIR - 7721
The Greek LettersChapter 15Options, Futures, and Other Derivatives, 6th Edition, Copyright John C. Hull 200515.1ExampleA bank has sold for \$300,000 a European call option on 100,000 shares of a nondividend paying stock S = 49, K = 50, r = 5
Auburn - ELEC - 4200
KCPSM38-bit Micro Controller for Spartan-3, Virtex-II and Virtex-IIPROFor Spartan-II(E) and Virtex(E) please use KCPSM Virtex-II and Virtex-IIPro are also supported by KCPSM2Ken Chapman Xilinx Ltd October 2003Rev.7ContentsUnderstanding KCPSM
WVU - RESM - 440
The Universal Transverse Mercator (UTM) GridMap ProjectionsThe most convenient way to identify points on the curved surface of the Earth is with a system of reference lines called parallels of latitude and meridians of longitude. On some maps, the
UVA - ASTR - 511
Getting Started with IDLIDL Version 6.0 July, 2003 EditionCopyright Research Systems, Inc. All Rights Reserved0703IDL60GSRestricted Rights NoticeThe IDL, ION ScriptTM, and ION JavaTM software programs and the accompanying procedures, functio
Ole Miss - CS - 490
EActiveState PerlE.1 IntroductionWhile Perl was initially developed on the UNIX platform, it was always intended to be a cross-platform computer language. ActivePerl is a version of Perl for Windows. The latest version of ActivePerl, the Perl 5.6
UGA - BCMB - 8020
REVIEWAssembly of Cell Regulatory Systems Through Protein Interaction DomainsTony Pawson1,2* and Piers Nash1 The sequencing of complete genomes provides a list that includes the proteins responsible for cellular regulation. However, this does not i
Montana - MB - 437
JOURNAL OF VIROLOGY, Aug. 2000, p. 70797084 0022-538X/00/\$04.00 0 Copyright 2000, American Society for Microbiology. All Rights Reserved.Vol. 74, No. 15A Hypothesis for DNA Viruses as the Origin of Eukaryotic Replication ProteinsLUIS P. VILLARR
UCSB - ECE - 124
Errata for the Dally/Poulton &quot;Digital Systems Engineering&quot; Text.This list compiled by Fred Rosenberger (fred@cse.wustl.edu, http:/www.cse.wustl.edu/~fred ) as an aid to anyone using the Dally/Poulton text. I expect some of the &quot;errors&quot; reported here
N.C. State - CSC - 405
&quot;&quot; % &amp;' () ' '\$#! \$# *'+ ,+-+./, # '34 ! ! ! ! &quot; ! #\$ '34 3 2 '34 6 \$ 0 1 ! 5, % % &amp; !07 .1,'
CSU Bakersfield - FIN - 600
18 - 1Distributions to Shareholders: Dividends and Repurchases Theories of investor preferences Signaling effects Residual model Dividend reinvestment plans Stock dividends and stock splits Stock repurchasesCopyright 2002 by Harcourt Inc. A
CSU Bakersfield - FIN - 600
13 - 1CHAPTER 13The Basics of Capital Budgeting: Evaluating Cash FlowsShould we build this plant?Copyright 2002 Harcourt, Inc.All rights reserved.13 - 2What is capital budgeting? Analysis of potential additions to fixed assets. Long-t
CSU Bakersfield - FIN - 600
20 - 1CHAPTER 20Lease Financing Types of leases Tax treatment of leases Effects on financial statements Lessee's analysis Lessor's analysis Other issues in lease analysisCopyright 2002 Harcourt, Inc. All rights reserved.20 - 2Who are t
CSU Bakersfield - FIN - 600
24 - 1CHAPTER 24Derivatives and Risk Management Risk management and stock value maximization. Derivative securities. Fundamentals of risk management. Using derivatives to reduce interest rate risk.Copyright 2002 Harcourt, Inc. All rights res
CSU Bakersfield - FIN - 600
12 - 1CHAPTER 12Corporate Valuation and ValueBased Management Corporate Valuation Value-Based Management Corporate GovernanceCopyright 2002 Harcourt, Inc.All rights reserved.12 - 2Corporate Valuation: List the two types of assets that
CSU Bakersfield - FIN - 600
10 - 1CHAPTER 10Stocks and Their Valuation Features of common stock Determining common stock values Efficient markets Preferred stockCopyright 2002 Harcourt, Inc. All rights reserved.10 - 2Facts about Common Stock Represents ownership.