# 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.

2 Pages

### greedy

Course: CS 240, Fall 2009
School: Cal Poly Pomona
Rating:

Word Count: 417

#### Document Preview

Graph Greedy Algorithms CS 240 Fall 1992 Craig A. Rich Single-source least-cost paths problem Dijkstras algorithm nds least-cost paths from vertex SOURCE to every vertex in the digraph represented by the labeled adjacency matrix A. LEAST(j) is the cost of a least-cost path from SOURCE to j, or INFINITY if no path exists. PARENT(j) is the parent of j in the tree of least-cost paths from SOURCE, or 0 if j is the...

Register Now

#### Unformatted Document Excerpt

Coursehero >> California >> Cal Poly Pomona >> CS 240

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.
Graph Greedy Algorithms CS 240 Fall 1992 Craig A. Rich Single-source least-cost paths problem Dijkstras algorithm nds least-cost paths from vertex SOURCE to every vertex in the digraph represented by the labeled adjacency matrix A. LEAST(j) is the cost of a least-cost path from SOURCE to j, or INFINITY if no path exists. PARENT(j) is the parent of j in the tree of least-cost paths from SOURCE, or 0 if j is the root. procedure DIJKSTRA (A: SOURCE: LEAST: PARENT: COST_MATRIX; VERTEX; out COST_VECTOR; out COST_VECTOR) is L: COST_VECTOR := (others => INFINITY); CERTAIN: array (VERTEX) of BOOLEAN := (others => FALSE); function CLOSEST_UNCERTAIN return VERTEX is CLOSEST: NATURAL := INFINITY; k: VERTEX; begin for j in VERTEX loop if not CERTAIN(j) and then L(j) < CLOSEST then CLOSEST := L(j); k := j; end if; end loop; return k; end CLOSEST_UNCERTAIN; procedure MAKE_CERTAIN (k: VERTEX) is begin CERTAIN(k) := TRUE; for j in VERTEX loop if not CERTAIN(j) and then L(k) + A(k,j) < L(j) then L(j) := L(k) + A(k,j); PARENT(j) := NATURAL(k); end if; end loop; end MAKE_CERTAIN; begin PARENT := (others => 0); L(SOURCE) := 0; for k in VERTEX loop MAKE_CERTAIN (CLOSEST_UNCERTAIN); end loop; LEAST := L; end DIJKSTRA; Minimum-cost tree spanning problem Prims algorithm nds a minimum-cost spanning tree of the connected graph represented by the symmetric labeled adjacency matrix A. PARENT(j) is the parent of j in the minimum-cost spanning tree, or 0 if j is the root. LEAST(j) is the cost of the edge {j, PARENT(j)} in the minimum-cost spanning tree, or 0 if j is the root; therefore, the minimum-cost spanning tree has cost n LEAST(j). j=1 procedure PRIM (A: SOURCE: LEAST: PARENT: COST_MATRIX; VERTEX; out COST_VECTOR; out COST_VECTOR) is L: COST_VECTOR := (others => INFINITY); CERTAIN: array (VERTEX) of BOOLEAN := (others => FALSE); function CLOSEST_UNCERTAIN return VERTEX is CLOSEST: NATURAL := INFINITY; k: VERTEX; begin for ...

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:

Cal Poly Pomona - EC - 201
MonopolyWhile a competitive firm is a price taker, a monopoly firm is a price maker.1MonopolyuAfirm is considered a monopoly if . . . it is the sole seller of its product. its product does not have close substitutes.2Why Monopolies Arise
Cal Poly Pomona - CS - 198904
Program 4CS 231 Fall 1989 Craig A. RichAdd implementations of the operations in the following abstract data type to the digraph ADT module created in program 3. These operations read and operate on labeled digraphs of type LABELED DIGRAPH. digrap
Cal Poly Pomona - CS - 231
Program 4CS 231 Fall 1989 Craig A. RichAdd implementations of the operations in the following abstract data type to the digraph ADT module created in program 3. These operations read and operate on labeled digraphs of type LABELED DIGRAPH. digrap
Cal Poly Pomona - EC - 201
Problem Set #5 suggested answersCal Poly Pomona, EC 201- Bruce Brown1) Non-excludability (inability to exclude people from consuming). 2) Pure Public Goods Goods Excludable? No Rival? No Pure Private Goods Yes Yes Common Resources No Yes Natural
Cal Poly Pomona - CS - 460
seedsecretHMACA(1)|secretseedHMACsecretHMACA(2)|secretseedHMACsecretHMACA(3 ) |secretseedHMAC length= hash sizeFigure 17.7TLS Function P_hash (secret, seed)
Cal Poly Pomona - CS - 199102
Homework 2CS 240 Spring 1991 Craig A. Rich1 In each of the following, give the simplest function f (n) such that the function T (n) expressed by the recurrence equations is big-theta of f (n). a) T (n) = b) T (n) = c) T (n) = 1, if n = 1; 3T (n/2
Cal Poly Pomona - CS - 240
Homework 2CS 240 Spring 1991 Craig A. Rich1 In each of the following, give the simplest function f (n) such that the function T (n) expressed by the recurrence equations is big-theta of f (n). a) T (n) = b) T (n) = c) T (n) = 1, if n = 1; 3T (n/2
Cal Poly Pomona - CS - 141
Final ExamCS 141 Winter 1991 Craig A. RichName: 1 Consider a binary tree whose elements are characters. Assuming characters and pointers require 1 and 4 bytes of storage respectively, calculate the total number of bytes required to store a binary
Cal Poly Pomona - CS - 199101
Final ExamCS 141 Winter 1991 Craig A. RichName: 1 Consider a binary tree whose elements are characters. Assuming characters and pointers require 1 and 4 bytes of storage respectively, calculate the total number of bytes required to store a binary
Cal Poly Pomona - CS - 441
Project SDDCS 441 Spring 1995 Craig A. RichThe following S-attributed syntax-directed definition defines Pure Lisp, in which most grammar symbols have one associated attribute and each production has one associated semantic rule. All attributes a
Cal Poly Pomona - EGR - 511
Chapter 2Iterative Methods for Solving Sets of Equations 2.4 Gradient Methods2.4.1 Gradients and Hessian Gradient methods use derivative information of a function to locate optima. At the location where the first derivative is equal to zero, the fu
Cal Poly Pomona - COURSE - 3
-&gt;example: Pr Pr Pr / ( x)(Hx v Kx)1. Fa 2. (x)(Fx Gx) 3. (x)(Gx Hx)-&gt;example: Pr / Fb ( x)Gx1. (x)(Fx Gx)- UI, EG apply to WHOLE lines 1. (x)Fx (x)Gx 2. Fa Ga 1. (x)(Fx Gx) 2. Fa Ga 1. Fb Gb 2. Fb ( x)Gx 1. Fb Gb 2. ( x)(Fx G
Cal Poly Pomona - MATH - 316
Geometric Interpretation of the Vector DerivativeLet be a smoothly varying, vector-valued function of a single (scalar) evolution variable , having both smoothly varying magnitude and direction At any instant during the continuing evolution of th
Cal Poly Pomona - MATH - 316
1/2Derivative &amp; Rotation Rate Vector of a Unit Vector = ()relative rotation plane1 = ()1u = u() ; &gt; o111 = uouo = u(o) plane within which the unit vector has rotated = () ~ non-negative of rotation relative to reference
Cal Poly Pomona - MATH - 316
Vector Derivative expressed in terms of its smoothly varying (time dependent) magnitude &amp; direction (unit vector) functions.u t = u t u t du = u = uu + uu dtA Vector's Derivative is determined by its current magnitude &amp; direction, as well as
Cal Poly Pomona - BIO - 431
Introduction to Geiger Counters A Geiger counter (Geiger-Muller tube) is a device used for the detection and measurement of all types of radiation: alpha, beta and gamma radiation. Basically it consists of a pair of electrodes surrounded by a gas. Th
Cal Poly Pomona - CHE - 441
1) A 1000 lb-mole per hour mixture of 5% methane, 20% ethane, 25% propane, 30% n-butane, and 20% n-pentane at 14.7 psia and 90F is to be compressed first to 50 psia, then to 200 psia using a two-stage compressor system. For the second stage, 938.3 lb
Cal Poly Pomona - CS - 441
Project Phase 1CS 441 Spring 1995 Craig A. Richgeneric - T y p e s -type Universe is private ; type Order is private ; -- O p e r a t i o n s -with function Compare ( Left, Right : Universe ) return Order is &lt;&gt; ; with function Equal ( Compare : O
Cal Poly Pomona - CS - 198904
Project Phase 2CS 441 Fall 1989 Craig A. RichConsider the following S-attributed syntax-directed definition, in which each grammar symbol has one associated attribute named val and each production has one associated semantic rule. All attributes
Cal Poly Pomona - CS - 441
Project Phase 2CS 441 Fall 1989 Craig A. RichConsider the following S-attributed syntax-directed definition, in which each grammar symbol has one associated attribute named val and each production has one associated semantic rule. All attributes
Cal Poly Pomona - CS - 441
Final ExamCS 441 Fall 1994 Craig A. Rich1 Consider the following CFG G: E LEAE+ E LEM E* Ed L A M a) Construct the canonical collection C of sets of LR(0) items which results from G after steps IIII of the SLR syntax analyzer construction. b)
Cal Poly Pomona - CS - 441
Project Phase 1CS 441 Fall 1992 Craig A. RichA Pure Lisp interpreter will be constructed of several packages in two phases. In order to insure synchronization of the phases, the constants and types which are used throughout the interpreter will b
Cal Poly Pomona - CS - 441
MidtermCS 441 Spring 1992 Craig A. RichName: 1 Let N = (ITEMS, , , i0 , F ) be the NFA that is constructed from the following CFG after steps III of the SLR syntax analyzer construction. S A B C a) Compute (A B, ). A|C AcB | AaC | B | a Bb |
Cal Poly Pomona - CS - 441
Project Phase 2CS 441 Spring 1993 Craig A. RichConsider the S-attributed syntax-directed denition for Pure Lisp, in which most grammar symbols have one associated attribute of type TREE and each production has one associated semantic rule. The se
Cal Poly Pomona - CS - 441
Final ExamCS 441 Fall 1991 Craig A. RichName: 1 Consider the following CFG G which generates a language of tours: Tour | Tour Move ; Move rotate literal | walk literal Construct an S-attributed attribute grammar from the underlying CFG G which
Cal Poly Pomona - CS - 441
Project SDDCS 441 Fall 1992 Craig A. RichThe following S-attributed syntax-directed denition denes Pure Lisp, in which most grammar symbols have one associated attribute and each production has one associated semantic rule. All attributes are of
Cal Poly Pomona - CS - 441
Project SDDCS 441 Winter 1994 Craig A. RichThe following S-attributed syntax-directed denition denes Pure Lisp, in which most grammar symbols have one associated attribute and each production has one associated semantic rule. All attributes are o
Cal Poly Pomona - CS - 441
Computer Science 441 (Section 1CRN 20816) (Section 2CRN 20817) Spring 1993 Compiler Design Instructor Craig A. Rich Oce: Bldg. 8, Room 40 Oce Hours: Mon,Wed 23:30; Tue,Thu 1112 Phone: (909)869-3447 Electronic mail: carich Section 1Lecture Meetings Ti
Cal Poly Pomona - CS - 441
Homework 3CS 441 Spring 1995 Craig A. Rich1 Given the following SDD: Productions LLS L S W C loop L end loop ; S id := E ; W while CE &lt;E EE +T ET T T F T F F (E ) F id F literal Semantic Ruleswriteln (GOTO top); write (end: ); writeln (STO
Cal Poly Pomona - CS - 441
Homework 3CS 441 Fall 1994 Craig A. Rich1 Given the following SDD: Productions LLS L S W C loop L end loop ; S id := E ; W while CE &lt;E EE +T ET T T F T F F (E ) F id F literal Semantic Ruleswriteln (GOTO top); write (end: ); writeln (STORE
Cal Poly Pomona - CS - 441
Computer Science 441 Section 1 (CRN 12013) Winter 1994 Compiler Design Instructor Craig A. Rich Oce: Bldg. 8, Room 40 Oce Hours: Mon,Wed 10:3012; Tue,Thu 12 Phone: (909)869-3447 Electronic mail: carich@csupomona.edu Lecture Meetings Time: Mon,Wed,Fri
Cal Poly Pomona - CS - 441
Computer Science 441 Section 1 (CRN 41964) Fall 1994 Compiler Design Instructor Craig A. Rich Oce: Bldg. 8, Room 40 Oce Hours: Mon,Wed 1112; Tue,Thu 2:304 Phone: (909)869-3447 Electronic mail: carich@csupomona.edu Lecture Meetings Time: Tue,Thu 4:005
Cal Poly Pomona - CS - 441
Computer Science 441 Section 1 (CRN 20816) Spring 1995 Compiler Design Instructor Craig A. Rich Office: Bldg. 8, Room 40 Office Hours: Mon,Wed 1112; Tue,Thu 2:304 Phone: (909)869-3447 Electronic mail: carich@csupomona.edu Lecture Meetings Time: Mon,W
Cal Poly Pomona - CS - 441
MidtermCS 441 Spring 2001 Craig A. RichProblems 12 refer to the following CFG G: S AB A aBb | B Cc | c CB1 SLR(1) Parse Table Construction a) Construct the canonical collection C of sets of LR(0) items which results from G after steps IIII
Cal Poly Pomona - CS - 441
Project SDDCS 441 Winter 1991 Craig A. RichThe following S-attributed syntax-directed denition denes pure Lisp, in which each grammar symbol has one associated attribute named attr and each production has one associated semantic rule. All attribu
Cal Poly Pomona - CS - 441
Computer Science 441 (CS 8944101) Fall 1991 Compiler Design Instructor Craig A. Rich Oce: Bldg. 8, Room 40 Oce Hours: Mon,Wed 12:001:00; Tue,Thu 1:002:30 Phone: (714)869-3447 Lecture Meetings Time: Mon,Wed,Fri 2:153:20 Place: Bldg. 8, Room 347 Textbo
Cal Poly Pomona - CS - 441
Project Phase 1 Pascal SpecificationsCS 441 Fall 1992 Craig A. Richlanguage.pas[environment] module LANGUAGE; const MAX_STRING_LENGTH = 30; MAX_alpha_LENGTH = 7; MAX_PRODUCTIONS_LENGTH = 24; type NATURAL = 0.MAXINT; STRING = varying [MAX_STRING_
Cal Poly Pomona - CS - 441
Computer Science 441 (CS 8944101) Winter 1991 Compiler Design Instructor Craig A. Rich Oce: Bldg. 8, Room 40 Oce Hours: Tue,Thu 9:0010:00; Wed,Fri 10:3012:00 Phone: (714)869-3447 Lecture Meetings Time: Tue,Thu 10:0011:50 Place: Bldg. 3, Room 214 Text
Cal Poly Pomona - PHY - 132
Cal Poly Pomona - PHY - 132
Cal Poly Pomona - PHY - 121
Phy 121L/131LPre-Lab: Conserved QuantitiesName:= Choose the best answer. Refer to the lab manual for the definitions of the variables used below. (10 pts total) 1. In Part 1, what is h? [1 pt] a. the height of the block above the table at the b
Cal Poly Pomona - PHY - 133
Physics 133 NameFinal ExamFall 2000PLEASE READ THIS FIRST: Work the problems on separate sheets of paper and staple this sheet to the front. Read each problem carefully. Show your work and/or give explanations for all answers. Make sure that al
Cal Poly Pomona - EC - 201
WHAT IS A COMPETITIVE MARKET? A perfectly competitive market has the following characteristics: There are many buyers and sellers in the market. The goods offered by the various sellers are largely the same. Firms can freely enter or exit the mar
Cal Poly Pomona - PHY - 133
Physics 133Problem Set #10Professor MallinckrodtNote: You should always work though the relevant examples in the text before attempting the homework problems. You may also want to work out some of the odd black end of the chapter problems which
TCNJ - CSC - 460
CSC460 (Spring 2005) Module A Evaluation FormName Self-evaluation (A, B, C possibly with +/) Adjustment by the instructorEvaluation Materials (Portfolio)Your evaluation materials (referred to as portfolio, and to be placed in the provided manila
TCNJ - CSC - 460
CSC460Name: _Exercise A6/B0, 2/8/05 Part 1: Simulating a TM Using a TMIn Module A, we discussed our intuition that the halting problem is semi-decidable and infinite-loop detection is non-TM-recognizable. In either case, it would be impossible t
TCNJ - CMSC - 250
he task: create a &quot;shell&quot; that will handle the mechanics of providing drill intruction ineither arithmetic or spelling. Implement a second system prototype that demonstrates the key features of the enhancements. MathDrill enha
Cal Poly Pomona - PHY - 133
Physics 133Problem Set #3Professor MallinckrodtNote: You should always work though the relevant examples in the text before attempting the homework problems. You may also want to work out some of the odd black end of the chapter problems which
TCNJ - ANSWE - 06
COMMUNICATION SKILLSVerbal Presentation1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26Non Verbal E x Score 4.00 3.50 5.00 5.00 4.00 4.50 4.50 3.50 3.00 3.50 5.00 3.00 2.50 4.00 4.00 3.50 3.00 3.00 4.00 5.00 3.50 4.50 2.50 3.
Cal Poly Pomona - URP - 337
URP 337 Planning public infrastructureWastewater and Laws about property-based taxesLecture 6 30 April 2001Number of governments in CaliforniaSchool districtsBut first Special districts notes on in-class assignment1New bond issues (\$bill
Cal Poly Pomona - CS - 664
As the limitations of traditional silicon based digital logic are reached in the effort to produce faster more powerful computers, new technologies promise the possibility of overcoming current hurdles. One possibility being researched is quantum com
Cal Poly Pomona - CS - 499
!&quot;#! \$ ! \$&amp; !&quot;\$## \$&quot;\$# %\$&quot;'(*&quot;)% &amp; % \$ # &amp; +# #, &quot; # '0 #). / ).. # &quot; \$ \$ # . )-# / /)&quot;\$)1 &quot;\$ 5 # &quot; 4 \$ / \$ # 2 # \$ / - &quot;\$ 3 40\$&quot; \$ \$4#&quot;\$ \$.5 . #* 6 3\$ # \$\$ 4 \$ \$)\$)# -/ 4 &quot; # 3 #
Cal Poly Pomona - EVENTS - 2
GROUP MEMORY: The Core Values of a Learning-Centered UniversityAt the April 22 Retreat on Becoming A Learning-Centered University, 40 students, 29 faculty, and 35 staff engaged in a shared activity to identify the core values of a learning-centered
Cal Poly Pomona - ECE - 322
P. R. Nelson1ECE 322L Experiment 1 Matlab Plotting and Curve Fitting: From Data to a Simple spice Model of an LED 1 Objectives using Matlab to fit a model to data, preparing graphs for professional reports.The objectives of this lab are to be
Cal Poly Pomona - ECE - 322
P. R. Nelson1ECE 322: Operational Ampliers and Electronic FeedbackHomework Assignment 1 Due Monday, 6 October1. Find the voltage V1 (a) from KVL and Ohms law. (b) from KCL and Ohms law. (c) by voltage division. (d) using superposition. 2. Find
Cal Poly Pomona - ECE - 330
Introduction to ECE 330Phyllis R. Nelsonprnelson@csupomona.eduProfessor, Department of Electrical and Computer Engineering California State Polytechnic University, PomonaP. R. Nelson ECE 330 Spring 2009 p. 1/19ECE 330 is aboutThe physics
Cal Poly Pomona - ECE - 322
P. R. Nelson1ECE 322L Experiment 2: Op Amp DC Characterization ICorrected version 5 October 20081Objectives measure DC op amp parameters compare the results to device specications develop experience with op amp circuits.The objectives o
Cal Poly Pomona - ECE - 220
P. R. Nelson1ECE 220: Electronic Devices and CircuitsGeneral InformationClass meets: Monday and Wednesday from 10:00 to 11:50 in 9-401 Instructor: Prof. Phyllis R. Nelson Oce: 9-131, email: prnelson@csupomona.edu, phone: (909) 869-2649 (email
Cal Poly Pomona - ECE - 322
Introduction to ECE 322Phyllis R. Nelsonprnelson@csupomona.eduCo-Director, Center for Macromolecular Modeling and Materials Design Professor, Department of Electrical and Computer Engineering California State Polytechnic University, PomonaP. R.
Cal Poly Pomona - ECE - 322
P. R. Nelson1ECE 322: Operational Ampliers and Electronic FeedbackGeneral InformationClass meets: Monday and Wednesday from 8:00 to 9:50 in 9-401 Instructor: Prof. Phyllis R. Nelson Oce: 9-131, email: prnelson@csupomona.edu, phone: (909) 869-2
Cal Poly Pomona - ECE - 322
P. R. Nelson Name(s):1ECE 322L Experiment 2 Op Amp DC Characterization I Scoring RubricAbsent/Minimal Prelab 2-5 (each) (Total: 8) Output Swing circuit data discussion Open Loop Gain circuit data discussion TOTAL none 0 not labeled 0-4 none 0 n