Name: 2 Useful Formulas Pn i=1 i = nèn+1è 2 Pn i=1 xi = xn+1,1 x,1 P Pn 1 =lnn + Oè1è 1 i=1 i i=0 = ixi x è1,xè 2 e x =1+x + x2 + x 3 2! 3! + ::: lim

Size: px
Start display at page:

Download "Name: 2 Useful Formulas Pn i=1 i = nèn+1è 2 Pn i=1 xi = xn+1,1 x,1 P Pn 1 =lnn + Oè1è 1 i=1 i i=0 = ixi x è1,xè 2 e x =1+x + x2 + x 3 2! 3! + ::: lim"

Transcription

1 1 Exam 2 Computer Engineering 251 Santa Clara University Thursday, 23 April 1998 NAME èprintedè NAME èsignedè Login Day of Lab Session Please show all your work and circle your answers. Your grade will be based on the the work shown. Question 1 è10 pointsè Question 2 è10 pointsè Question 3 è10 pointsè Question 4 è10 pointsè Question 5 è10 pointsè Question 6 è10 pointsè Question 7 è20 pointsè Question 8 è20 pointsè TOTAL

2 Name: 2 Useful Formulas Pn i=1 i = nèn+1è 2 Pn i=1 xi = xn+1,1 x,1 P Pn 1 =lnn + Oè1è 1 i=1 i i=0 = ixi x è1,xè 2 e x =1+x + x2 + x 3 2! 3! + ::: lim n!1è1 + x n èn = e x n! = p 2çnè n e èn è1+æè 1 n èè n! =oènn è n! =!è2 n è lgèn!è = æèn lg nè ç çn enk ç è èk çn kç = n! è n k!èn,kè! k èk ç EëXë = Px xp rëx = xë VarëXë =EëèX, EëXëè 2 ë = EëX 2 ë, E 2 ëxë k íput gatesèformulas hereí

3 Name: 3 1. è10 pointsè 5 short answers èmorningè or 10 TèF èeveningè èaè Inaæow network, the æow on an edge is always larger than the capacity of the edge. èbè The longest simple path in an undirected graph has at most V, 1 edges. ècè èdè èeè Greedy algorithms always ænd the optimal solution to a problem. Every logical gate has fan-in 2 èthat is, has exactly 2 inputsè. Prim's Algorithm and Kruskal's Algorithm solve the same problem. èfè How many diæerent minimal spanning trees are there on a triangle with edge weights 1 èthat is, the graph G =èf1; 2; 3g; fè1; 2è; è1; 3è; è2; 3èg and wè1; 3è = wè1; 3è = wè2; 3è = 1è? ègè What is the most number of edges possible in a matching on a graph G =èv; Eè, where the number of vertices is even? èhè In a æow network, what is the capacity of a path, p, if the capacity of each edge èu; vè iscèu; vè? èiè How can the number of strongly connected components in a graph change if a new edge is added? èjè If an undirected graph has E edges and V vertics, how many edges does a spanning tree of the graph have? 2. è10 pointsè Huæman encoding èaè Given the following character set and the frequency each letter occurs, construct a Huæman code for the character set: a b c d e f Frequency èin thousandsè èbè Given the following character set and the frequency each letter occurs, construct a Huæman code for the character set: a b c d e f Frequency èin thousandsè

4 Name: 4 3. è10 pointsè Give algorithm and example èaè èmorningè i. Write Dijkstra's Algorithm. ii. Give a simple example of a directed graph with negative-weight edges for which Dijkstra's Algorithm produces incorrect answers. èbè èeveningè i. Write Kruskal's Algorithm ii. Suppose that all the edge weights in the graph are integers in the range from 1 to jv j. How fast can you make Kruskal's Algorithm run? 4. è10 pointsè Analyze graph algorithms èaè Analyze the following algorithm: G is a directed graph with weight function w and s is a vertex of G. BELLMAN-FORDèG,w,sè 1 INITIALIZE-SINGLE-SOURCEèG,sè 2 for i é- 1 to VëGë do for each edge èu,vè in EëGë 4 do RELAXèu,v,wè 5 for each edge èu,vè in EëGë 6 do if dëvë é dëuë + wèu,vè 7 then return FALSE 8 return TRUE INITIALIZE-SINGLE-SOURCEèG,sè 1 for each vertex v in VëGë 2 do dëvë é- infinity 3 pëvë é- NIL 4 dësë é- 0 RELAXèu,v,wè 1 if dëvë é dëuë + wèu,vè 2 then dëvë é- dëuë + wèu,vè 3 pëvë é- u èbè Analyze the following algorithm. You may assume that all æows are integer-valued èthat is, fëu,vë is always an integerè and jf æjis the value of the maximal æow.

5 Name: 5 G is a directed graph with s and t vertices in G. ènote: Due to typesetting FORD-FULKERSONèG,s,tè 1 for each edge èu,vè in EëGë 2 do fëu,vë é- 0 3 fëv,uë é- 0 4 while there exists a path p from s to t in the residual network Gf 5 do cfèpè é- minícfèu,vè : èu,vè is in pí 6 for each edge èu,vè in p 7 do fëu,vë é- fëu,vë + cfèpè 8 fëv,uë é- - fëu,vë 5. è10 pointsè Simple circuit question èaè i. Draw a circuit that takes 3 bit inputs x; y; z and return 1 if their sum is odd and 0 if their sum is even. ii. Draw a circuit that takes 4 bit inputs x; y; z; w and return 1 if their sum is odd and 0 if their sum is even. èbè i. Draw a circuit that takes 3 bit inputs x; y; z. The circuit should have 2 outputs: c and s. The output c should be 1 iæ at least 2 of the inputs are 1. The output s should be 1 if the sum of the inputs is odd and 0 if sum of the inputs is even. ii. Use your circuit from above to design a circuit that will add two 4- digit binary numbers. èyou may represent the circuit from above as a ëblack box" instead of redrawing it for this part of the question.è 6. è10 pointsè èaè Draw an example of æow network with a æow that is not maximal. Label the edges of your graph with the æow and capacity of the edge. Also indicate an augmenting path for your æow. èbè Show that for any graph G =èv; Eè, there exists a minimal spanning tree that contains the minimal weight edge. 7. è20 pointsè Solve recurrences using generating functions èaè Solve the following recurrence: T n+2 =2T n+1, T n for n ç 0, T 0 =0;T 1 =1 èhint: let T èxè = Pn T n x n, solve for Tèxè, and use formulas about sums to decide the coeæentsè.

6 Name: 6 èbè Solve the following recurrence: T n = nx k=0 T k for n ç 1, T 0 =1 èhint: let T èxè = Pn T n x n, solve for Tèxè, and use formulas about sums to decide the coeæentsè. 8. è20 pointsè Design an algorithm... èaè è20 pointsè Design a greedy algorithm for storing web pages in memory. The total size of memory is M. As each page arrives, you should place it memory if space is available. If space is not available, you should remove another page èor pagesè from memory and insert your page. The pages will be speciæed by their size only. For example, if M = 10 and the sequence of page sizes is 1; 5; 8; 1, you would insert the ærst 2 pages, then need to remove at least the second page to insert the third page. After that you, you can insert the fourth page. Please specify the data structures you used and give an analysis of the program. èbè è20 pointsè Arbitrage is the use of discrepencies in currency exchange rates to transform one unit of currency into more than one unit of the same currency. For example, suppose that 1 US dollar buys 0.7 British pounds, 1 British pound buys 9.5 French francs, and 1 French franc buys 0.16 dollars. By converting currencies, a trader can start with 1 US dollar and end up with 1 æ 0:7 æ 9:5 æ 0:16=1:064 dollars, and then returning a proæt of 6.4è. Suppose that we are given n currencies c 1 ;c 2 ;:::;c n and an n æ n table R of exchange rates such that one unit of c i buys Rëi; jë units of currency c j. Give an eæcient algorithm for deciding whether or not there exists a sequence of currencies that will yield a proæt. Specify any data structures you use and give ananalysis of the program.

PART I. Answer each of the following. è1è Let! u = h2;,1;,2i and! v = h3; 1;,1i. Calculate: èaè! u, 2! v èbè the dot product of! u and! v ècè! u æ! v

PART I. Answer each of the following. è1è Let! u = h2;,1;,2i and! v = h3; 1;,1i. Calculate: èaè! u, 2! v èbè the dot product of! u and! v ècè! u æ! v MATH 241: FINAL EXAM Name Instructions and Point Values: Put your name in the space provided above. Check that your test contains 14 diæerent pages including one blank page. Work each problem below and

More information

rate name People Consult Topics name rate name People Consult Topics name

rate name People Consult Topics name rate name People Consult Topics name Midterm Examination æ Please read all instructions èincluding theseè carefully. æ There are 5 problems on the exam, with a varying number of points for each problem and subproblem for a total of 75 points.

More information

Data Structure and Algorithm Homework #5 Due: 2:00pm, Thursday, May 31, 2012 TA === Homework submission instructions ===

Data Structure and Algorithm Homework #5 Due: 2:00pm, Thursday, May 31, 2012 TA   === Homework submission instructions === Data Structure and Algorithm Homework #5 Due: 2:00pm, Thursday, May 1, 2012 TA email: dsa1@csie.ntu.edu.tw === Homework submission instructions === For Problem 1, submit your source code, a shell script

More information

Math 241: Calculus III Final Exam è300 points totalè Show All Work Name This test consists of 2 parts. There are 10 problems in Part I, each worth 18

Math 241: Calculus III Final Exam è300 points totalè Show All Work Name This test consists of 2 parts. There are 10 problems in Part I, each worth 18 Math 241: Calculus III Final Exam è300 points totalè Show All Work Name This test consists of 2 parts. There are 10 problems in Part I, each worth 18 points; and there are 5 problems in Part II, each worth

More information

19.2 View Serializability. Recall our discussion in Section?? of how our true goal in the design of a

19.2 View Serializability. Recall our discussion in Section?? of how our true goal in the design of a 1 19.2 View Serializability Recall our discussion in Section?? of how our true goal in the design of a scheduler is to allow only schedules that are serializable. We also saw how differences in what operations

More information

Graph Algorithms (part 3 of CSC 282),

Graph Algorithms (part 3 of CSC 282), Graph Algorithms (part of CSC 8), http://www.cs.rochester.edu/~stefanko/teaching/10cs8 1 Schedule Homework is due Thursday, Oct 1. The QUIZ will be on Tuesday, Oct. 6. List of algorithms covered in the

More information

SUGGESTION : read all the questions and their values before you start.

SUGGESTION : read all the questions and their values before you start. Faculty of Science Final Examination Computer Science 308-251B Examiner: Prof. Claude Crépeau Date: April 30, 2010 Associate Examiner: Prof. Patrick Hayden Time: 09:00 12:00 INSTRUCTIONS: This examination

More information

Fundamental Algorithms CSCI-GA /Summer Solution to Homework 8

Fundamental Algorithms CSCI-GA /Summer Solution to Homework 8 Fundamental Algorithms CSCI-GA.70-00/Summer 206 Solution to Homework 8 Problem (CLRS 23.-6). ( point) Show that a graph has a unique minimum spanning tree if, for every cut of the graph, there is a unique

More information

END-TERM EXAMINATION

END-TERM EXAMINATION (Please Write your Exam Roll No. immediately) Exam. Roll No... END-TERM EXAMINATION Paper Code : MCA-205 DECEMBER 2006 Subject: Design and analysis of algorithm Time: 3 Hours Maximum Marks: 60 Note: Attempt

More information

Exam 3 Practice Problems

Exam 3 Practice Problems Exam 3 Practice Problems HONOR CODE: You are allowed to work in groups on these problems, and also to talk to the TAs (the TAs have not seen these problems before and they do not know the solutions but

More information

Inænitely Long Walks on 2-colored Graphs Which Don't Cover the. Graph. Pete Gemmell æ. December 14, Abstract

Inænitely Long Walks on 2-colored Graphs Which Don't Cover the. Graph. Pete Gemmell æ. December 14, Abstract Inænitely Long Walks on 2-colored Graphs Which Don't Cover the Graph Pete Gemmell æ December 14, 1992 Abstract Suppose we have a undirected graph G =èv; Eè where V is the set of vertices and E is the set

More information

1. Consider the 62-element set X consisting of the twenty-six letters (case sensitive) of the English

1. Consider the 62-element set X consisting of the twenty-six letters (case sensitive) of the English MATH 3012 Final Exam, May 3, 2013, WTT Student Name and ID Number 1. Consider the 62-element set X consisting of the twenty-six letters (case sensitive) of the English alphabet and the ten digits {0, 1,

More information

Graph Algorithms (part 3 of CSC 282),

Graph Algorithms (part 3 of CSC 282), Graph Algorithms (part of CSC 8), http://www.cs.rochester.edu/~stefanko/teaching/11cs8 Homework problem sessions are in CSB 601, 6:1-7:1pm on Oct. (Wednesday), Oct. 1 (Wednesday), and on Oct. 19 (Wednesday);

More information

Problem 1. Which of the following is true of functions =100 +log and = + log? Problem 2. Which of the following is true of functions = 2 and =3?

Problem 1. Which of the following is true of functions =100 +log and = + log? Problem 2. Which of the following is true of functions = 2 and =3? Multiple-choice Problems: Problem 1. Which of the following is true of functions =100+log and =+log? a) = b) =Ω c) =Θ d) All of the above e) None of the above Problem 2. Which of the following is true

More information

Solutions to Final. Solutions to Final. May 18th CS170 David Wolfe ALWAYS TRUE SOMETIMES TRUE NEVER TRUE

Solutions to Final. Solutions to Final. May 18th CS170 David Wolfe ALWAYS TRUE SOMETIMES TRUE NEVER TRUE Solutions to Final May 18th 1995 CS170 David Wolfe 1. (30 points) Check one box for each of the following. ALWAYS TRUE SOMETIMES TRUE NEVER TRUE In a connected graph, E=O(V) In a connected graph, E=Ω(V)

More information

Department of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I

Department of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I MCA 312: Design and Analysis of Algorithms [Part I : Medium Answer Type Questions] UNIT I 1) What is an Algorithm? What is the need to study Algorithms? 2) Define: a) Time Efficiency b) Space Efficiency

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

Introduction to Algorithms May 14, 2003 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser.

Introduction to Algorithms May 14, 2003 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser. Introduction to Algorithms May 14, 2003 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Practice Final Practice Final Do not open this exam booklet until

More information

CS345 Midterm Examination. Wednesday, May 14, 2003, 9:30 í 11:30AM. Directions. The exam is open book; any written materials may be used.

CS345 Midterm Examination. Wednesday, May 14, 2003, 9:30 í 11:30AM. Directions. The exam is open book; any written materials may be used. CS345 Midterm Examination Wednesday, May 14, 2003, 9:30 í 11:30AM Directions æ æ æ æ The exam is open book; any written materials may be used. Answer all 9 questions on the exam paper itself. The total

More information

Student Name and ID Number. MATH 3012 Final Exam, December 11, 2014, WTT

Student Name and ID Number. MATH 3012 Final Exam, December 11, 2014, WTT MATH 3012 Final Exam, December 11, 2014, WTT Student Name and ID Number 1. Consider the 11-element set X consisting of the three capital letters {A, B, C} and the eight digits {0, 1, 2,..., 7}. a. How

More information

( ) n 3. n 2 ( ) D. Ο

( ) n 3. n 2 ( ) D. Ο CSE 0 Name Test Summer 0 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n n matrices is: A. Θ( n) B. Θ( max( m,n, p) ) C.

More information

CS 5515 Fall Solution to Test è1. Open booksènotes; calculator allowed

CS 5515 Fall Solution to Test è1. Open booksènotes; calculator allowed CS 5515 Fall 1997 Solution to Test è1 Oen booksènotes; calculator allowed 1. Consider a standard DLX IntèFT ieline with 5 stages: IF, ID, EX, M and WB. The execution unit can execute æoating oint or integer

More information

(a) Write code to do this without using any floating-point arithmetic. Efficiency is not a concern here.

(a) Write code to do this without using any floating-point arithmetic. Efficiency is not a concern here. CS 146 Final Exam 1 Solutions by Dr. Beeson 1. Analysis of non-recursive algorithms. Consider the problem of counting the number of points with integer coordinates (x,y) on the circle of radius R, where

More information

1. Let n and m be positive integers with n m. a. Write the inclusion/exclusion formula for the number S(n, m) of surjections from {1, 2,...

1. Let n and m be positive integers with n m. a. Write the inclusion/exclusion formula for the number S(n, m) of surjections from {1, 2,... MATH 3012, Quiz 3, November 24, 2015, WTT Student Name and ID Number 1. Let n and m be positive integers with n m. a. Write the inclusion/exclusion formula for the number S(n, m) of surjections from {1,

More information

The ray tracing software package implements an object-oriented approach to

The ray tracing software package implements an object-oriented approach to Chapter 1 RayTracing 1.1 Using the ray tracer package The ray tracing software package implements an object-oriented approach to rendering and ray tracing. The object oriented design includes base classes

More information

Boundary layer quadrilateral. Boundary layer

Boundary layer quadrilateral. Boundary layer CHAPTER 5 BOUNDARY LAYER MESHING - GROWTH CURVES 5.1 Boundary Layer Meshing Notations Cj i p i j;k Mi;j;k 0 fp i jg c i j;k Mi;j;k 1 fc i jg j th growth curve originating from Mi 0 k th node of the j th

More information

4/8/11. Single-Source Shortest Path. Shortest Paths. Shortest Paths. Chapter 24

4/8/11. Single-Source Shortest Path. Shortest Paths. Shortest Paths. Chapter 24 /8/11 Single-Source Shortest Path Chapter 1 Shortest Paths Finding the shortest path between two nodes comes up in many applications o Transportation problems o Motion planning o Communication problems

More information

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29 Lecture 13 Connectedness in graphs Spanning trees in graphs Finding a minimal spanning tree Time costs of graph problems and NP-completeness Finding a minimal spanning tree: Prim s and Kruskal s algorithms

More information

CS161 - Final Exam Computer Science Department, Stanford University August 16, 2008

CS161 - Final Exam Computer Science Department, Stanford University August 16, 2008 CS161 - Final Exam Computer Science Department, Stanford University August 16, 2008 Name: Honor Code 1. The Honor Code is an undertaking of the students, individually and collectively: a) that they will

More information

logn D. Θ C. Θ n 2 ( ) ( ) f n B. nlogn Ο n2 n 2 D. Ο & % ( C. Θ # ( D. Θ n ( ) Ω f ( n)

logn D. Θ C. Θ n 2 ( ) ( ) f n B. nlogn Ο n2 n 2 D. Ο & % ( C. Θ # ( D. Θ n ( ) Ω f ( n) CSE 0 Test Your name as it appears on your UTA ID Card Fall 0 Multiple Choice:. Write the letter of your answer on the line ) to the LEFT of each problem.. CIRCLED ANSWERS DO NOT COUNT.. points each. The

More information

Solving problems on graph algorithms

Solving problems on graph algorithms Solving problems on graph algorithms Workshop Organized by: ACM Unit, Indian Statistical Institute, Kolkata. Tutorial-3 Date: 06.07.2017 Let G = (V, E) be an undirected graph. For a vertex v V, G {v} is

More information

skim it quickly and read any sections that appear both relevant and accessible.

skim it quickly and read any sections that appear both relevant and accessible. Chapter 1 Bçezier curves and Splines This a very incomplete and rough draft, so please read it with caution. Many topics are just skipped, and there are no pictures at all. My suggestion is that you skim

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 3 Definitions an undirected graph G = (V, E)

More information

( D. Θ n. ( ) f n ( ) D. Ο%

( D. Θ n. ( ) f n ( ) D. Ο% CSE 0 Name Test Spring 0 Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to run the code below is in: for i=n; i>=; i--) for j=; j

More information

CS521 \ Notes for the Final Exam

CS521 \ Notes for the Final Exam CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )

More information

Question Points Score TOTAL 55 TOTAL (Calibrated) 50

Question Points Score TOTAL 55 TOTAL (Calibrated) 50 UCSD CSE 101 Section B00, Winter 2015 FINAL EXAM March 19, 2015 NAME: Student ID: Question Points Score 1 25 2 10 3 10 4 10 TOTAL 55 TOTAL (Calibrated) 50 INSTRUCTIONS. Be clear and concise. Write your

More information

Minimum Spanning Tree

Minimum Spanning Tree Minimum Spanning Tree 1 Minimum Spanning Tree G=(V,E) is an undirected graph, where V is a set of nodes and E is a set of possible interconnections between pairs of nodes. For each edge (u,v) in E, we

More information

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions Introduction Chapter 9 Graph Algorithms graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 2 Definitions an undirected graph G = (V, E) is

More information

n 2 ( ) ( ) + n is in Θ n logn

n 2 ( ) ( ) + n is in Θ n logn CSE Test Spring Name Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply an m n matrix and a n p matrix is in: A. Θ( n) B. Θ( max(

More information

COMPSCI 311: Introduction to Algorithms First Midterm Exam, October 3, 2018

COMPSCI 311: Introduction to Algorithms First Midterm Exam, October 3, 2018 COMPSCI 311: Introduction to Algorithms First Midterm Exam, October 3, 2018 Name: ID: Answer the questions directly on the exam pages. Show all your work for each question. More detail including comments

More information

Your favorite blog : (popularly known as VIJAY JOTANI S BLOG..now in facebook.join ON FB VIJAY

Your favorite blog :  (popularly known as VIJAY JOTANI S BLOG..now in facebook.join ON FB VIJAY Course Code : BCS-042 Course Title : Introduction to Algorithm Design Assignment Number : BCA(IV)-042/Assign/14-15 Maximum Marks : 80 Weightage : 25% Last Date of Submission : 15th October, 2014 (For July

More information

CS 161 Fall 2015 Final Exam

CS 161 Fall 2015 Final Exam CS 161 Fall 2015 Final Exam Name: Student ID: 1: 2: 3: 4: 5: 6: 7: 8: Total: 1. (15 points) Let H = [24, 21, 18, 15, 12, 9, 6, 3] be an array of eight numbers, interpreted as a binary heap with the maximum

More information

Math Summer 2012

Math Summer 2012 Math 481 - Summer 2012 Final Exam You have one hour and fifty minutes to complete this exam. You are not allowed to use any electronic device. Be sure to give reasonable justification to all your answers.

More information

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 7 Lecturer: David Wagner February 13, Notes 7 for CS 170

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 7 Lecturer: David Wagner February 13, Notes 7 for CS 170 UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 7 Lecturer: David Wagner February 13, 003 Notes 7 for CS 170 1 Dijkstra s Algorithm Suppose each edge (v, w) of our graph has a

More information

The Shortest Path Problem. The Shortest Path Problem. Mathematical Model. Integer Programming Formulation

The Shortest Path Problem. The Shortest Path Problem. Mathematical Model. Integer Programming Formulation The Shortest Path Problem jla,jc@imm.dtu.dk Department of Management Engineering Technical University of Denmark The Shortest Path Problem Given a directed network G = (V,E,w) for which the underlying

More information

NANYANG TECHNOLOGICAL UNIVERSITY SEMESTER II EXAMINATION MH 1301 DISCRETE MATHEMATICS TIME ALLOWED: 2 HOURS

NANYANG TECHNOLOGICAL UNIVERSITY SEMESTER II EXAMINATION MH 1301 DISCRETE MATHEMATICS TIME ALLOWED: 2 HOURS NANYANG TECHNOLOGICAL UNIVERSITY SEMESTER II EXAMINATION 2015-2016 MH 1301 DISCRETE MATHEMATICS May 2016 TIME ALLOWED: 2 HOURS INSTRUCTIONS TO CANDIDATES 1. This examination paper contains FIVE (5) questions

More information

RYERSON UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE CPS 616 FINAL EXAM WINTER 2018

RYERSON UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE CPS 616 FINAL EXAM WINTER 2018 RYERSON UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE CPS 616 FINAL EXAM WINTER 2018 INSTRUCTIONS This exam is 3 hours long. This exam is out of 70 and is worth 55% of the course mark. This is a closed book

More information

Multiple Choice. Write your answer to the LEFT of each problem. 3 points each

Multiple Choice. Write your answer to the LEFT of each problem. 3 points each CSE 0-00 Test Spring 0 Name Last 4 Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. Suppose f ( x) is a monotonically increasing function. Which of the

More information

where C is traversed in the clockwise direction, r 5 èuè =h, sin u; cos ui; u ë0; çè; è6è where C is traversed in the counterclockwise direction èhow

where C is traversed in the clockwise direction, r 5 èuè =h, sin u; cos ui; u ë0; çè; è6è where C is traversed in the counterclockwise direction èhow 1 A Note on Parametrization The key to parametrizartion is to realize that the goal of this method is to describe the location of all points on a geometric object, a curve, a surface, or a region. This

More information

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018 CS Section # Shortest Paths and MSTs //08 Shortest Paths There are types of shortest paths problems: Single source single destination Single source to all destinations All pairs shortest path In today

More information

CMSC351 - Fall 2014, Final Exam

CMSC351 - Fall 2014, Final Exam CMSC351 - Fall 2014, Final Exam Type A WAIT FOR INSTRUCTIONS BEFORE BEGINNING HONOR PLEDGE: I pledge on my honor that I have not given or received any unauthorized assistance on this examination. Signature

More information

Dijkstra s algorithm for shortest paths when no edges have negative weight.

Dijkstra s algorithm for shortest paths when no edges have negative weight. Lecture 14 Graph Algorithms II 14.1 Overview In this lecture we begin with one more algorithm for the shortest path problem, Dijkstra s algorithm. We then will see how the basic approach of this algorithm

More information

Worksheet for the Final Exam - Part I. Graphs

Worksheet for the Final Exam - Part I. Graphs Worksheet for the Final Exam - Part I. Graphs Date and Time: May 10 2012 Thursday 11:50AM~1:50PM Location: Eng 120 Start with the Self-Test Exercises (pp.816) in Prichard. 1. Give the adjacency matrix

More information

Spanning Trees. Lecture 20 CS2110 Spring 2015

Spanning Trees. Lecture 20 CS2110 Spring 2015 1 Spanning Trees Lecture 0 CS110 Spring 01 1 Undirected trees An undirected graph is a tree if there is exactly one simple path between any pair of vertices Root of tree? It doesn t matter choose any vertex

More information

( ) 1 B. 1. Suppose f x

( ) 1 B. 1. Suppose f x CSE Name Test Spring Last Digits of Student ID Multiple Choice. Write your answer to the LEFT of each problem. points each is a monotonically increasing function. Which of the following approximates the

More information

TA: Jade Cheng ICS 241 Recitation Lecture Notes #12 November 13, 2009

TA: Jade Cheng ICS 241 Recitation Lecture Notes #12 November 13, 2009 TA: Jade Cheng ICS 241 Recitation Lecture Notes #12 November 13, 2009 Recitation #12 Question: Use Prim s algorithm to find a minimum spanning tree for the given weighted graph. Step 1. Start from the

More information

CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 02/26/15

CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 02/26/15 CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh (rezab@stanford.edu) HW#3 Due at the beginning of class Thursday 02/26/15 1. Consider a model of a nonbipartite undirected graph in which

More information

CS261: Problem Set #2

CS261: Problem Set #2 CS261: Problem Set #2 Due by 11:59 PM on Tuesday, February 9, 2016 Instructions: (1) Form a group of 1-3 students. You should turn in only one write-up for your entire group. (2) Submission instructions:

More information

Homework 5: Graphs, Minimum Spanning Trees, and Dijkstra Shortest-Path

Homework 5: Graphs, Minimum Spanning Trees, and Dijkstra Shortest-Path Homework 5: Graphs, Minimum Spanning Trees, and Dijkstra Shortest-Path 1. (4 points) A graph is Hamiltonian if there is a cycle in the graph visiting each vertex exactly once. Give an example of an Eulerian

More information

2. True or false: even though BFS and DFS have the same space complexity, they do not always have the same worst case asymptotic time complexity.

2. True or false: even though BFS and DFS have the same space complexity, they do not always have the same worst case asymptotic time complexity. 1. T F: Consider a directed graph G = (V, E) and a vertex s V. Suppose that for all v V, there exists a directed path in G from s to v. Suppose that a DFS is run on G, starting from s. Then, true or false:

More information

Theorem 2.9: nearest addition algorithm

Theorem 2.9: nearest addition algorithm There are severe limits on our ability to compute near-optimal tours It is NP-complete to decide whether a given undirected =(,)has a Hamiltonian cycle An approximation algorithm for the TSP can be used

More information

18 Spanning Tree Algorithms

18 Spanning Tree Algorithms November 14, 2017 18 Spanning Tree Algorithms William T. Trotter trotter@math.gatech.edu A Networking Problem Problem The vertices represent 8 regional data centers which need to be connected with high-speed

More information

Ma/CS 6a Class 27: Shortest Paths

Ma/CS 6a Class 27: Shortest Paths // Ma/CS a Class 7: Shortest Paths By Adam Sheffer Naïve Path Planning Problem. We are given a map with cities and noncrossing roads between pairs of cities. Describe an algorithm for finding a path between

More information

APPM 4120/5120 Exam #2 Practice Solutions Spring 2015

APPM 4120/5120 Exam #2 Practice Solutions Spring 2015 APPM 4120/5120 Exam #2 Practice Solutions Spring 2015 You are not allowed to use textbooks, class notes. Problem #1 (20 points): Consider the following activity-on-arc project network, where the 12 arcs

More information

University of New Mexico Department of Computer Science. Final Examination. CS 362 Data Structures and Algorithms Spring, 2006

University of New Mexico Department of Computer Science. Final Examination. CS 362 Data Structures and Algorithms Spring, 2006 University of New Mexico Department of Computer Science Final Examination CS 6 Data Structures and Algorithms Spring, 006 Name: Email: Print your name and email, neatly in the space provided above; print

More information

n 2 C. Θ n ( ) Ο f ( n) B. n 2 Ω( n logn)

n 2 C. Θ n ( ) Ο f ( n) B. n 2 Ω( n logn) CSE 0 Name Test Fall 0 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to find the maximum of the n elements of an integer array is in: A.

More information

ECE250: Algorithms and Data Structures Final Review Course

ECE250: Algorithms and Data Structures Final Review Course ECE250: Algorithms and Data Structures Final Review Course Ladan Tahvildari, PEng, SMIEEE Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp. Eng. University of Waterloo

More information

( ). Which of ( ) ( ) " #& ( ) " # g( n) ( ) " # f ( n) Test 1

( ). Which of ( ) ( )  #& ( )  # g( n) ( )  # f ( n) Test 1 CSE 0 Name Test Summer 006 Last Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n x n matrices is: A. "( n) B. "( nlogn) # C.

More information

1 Format. 2 Topics Covered. 2.1 Minimal Spanning Trees. 2.2 Union Find. 2.3 Greedy. CS 124 Quiz 2 Review 3/25/18

1 Format. 2 Topics Covered. 2.1 Minimal Spanning Trees. 2.2 Union Find. 2.3 Greedy. CS 124 Quiz 2 Review 3/25/18 CS 124 Quiz 2 Review 3/25/18 1 Format You will have 83 minutes to complete the exam. The exam may have true/false questions, multiple choice, example/counterexample problems, run-this-algorithm problems,

More information

Department of Computer Science and Engineering Analysis and Design of Algorithm (CS-4004) Subject Notes

Department of Computer Science and Engineering Analysis and Design of Algorithm (CS-4004) Subject Notes Page no: Department of Computer Science and Engineering Analysis and Design of Algorithm (CS-00) Subject Notes Unit- Greedy Technique. Introduction: Greedy is the most straight forward design technique.

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures 3 Definitions an undirected graph G = (V, E) is a

More information

term Oè1=n k è. This time bound is a substantial improvement for sparse graphs. Still in the dense case this algorithm is slower than the original GW

term Oè1=n k è. This time bound is a substantial improvement for sparse graphs. Still in the dense case this algorithm is slower than the original GW The Dynamic Vertex Minimum Problem and Its Application to Clustering-type Approximation Algorithms Harold N. Gabow æ Seth Pettie y April 18, 2002 Abstract The dynamic vertex minimum problem èdvmpè is to

More information

CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS

CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS Analyzing find in B-trees Since the B-tree is perfectly height-balanced, the worst case time cost for find is O(logN) Best case: If every internal node is completely

More information

Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W.

Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W. : Coping with NP-Completeness Course contents: Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems Reading: Chapter 34 Chapter 35.1, 35.2 Y.-W. Chang 1 Complexity

More information

One motivation for developing axiomatic systems is to determine precisely which properties

One motivation for developing axiomatic systems is to determine precisely which properties 1 Axiomatic Systems 1.1 Features of Axiomatic Systems One motivation for developing axiomatic systems is to determine precisely which properties of certain objects can be deduced from which other properties.

More information

CMPSCI 311: Introduction to Algorithms Practice Final Exam

CMPSCI 311: Introduction to Algorithms Practice Final Exam CMPSCI 311: Introduction to Algorithms Practice Final Exam Name: ID: Instructions: Answer the questions directly on the exam pages. Show all your work for each question. Providing more detail including

More information

CMSC Theory of Algorithms Second Midterm

CMSC Theory of Algorithms Second Midterm NAME (please PRINT in large letters): SECTION: 01 02 (circle one) CMSC 27200 Theory of Algorithms Second Midterm 02-26-2015 The exam is closed book. Do not use notes. The use of ELECTRONIC DEVICES is strictly

More information

53 M 0 j èm 2 i è ;1 M 0 j èm 2 i è ;1 èm 2 i è ;0 èm 2 i è ;0 (a) (b) M 0 i M 0 i (c) (d) Figure 6.1: Invalid boundary layer elements due to invisibi

53 M 0 j èm 2 i è ;1 M 0 j èm 2 i è ;1 èm 2 i è ;0 èm 2 i è ;0 (a) (b) M 0 i M 0 i (c) (d) Figure 6.1: Invalid boundary layer elements due to invisibi CHAPTER 6 BOUNDARY LAYER MESHING - ENSURING ELEMENT VALIDITY Growth curves are created with maximum consideration for topological validity and topological compatibility with the model. However, only preliminary

More information

REDUCTION CUT INVERTED SUM

REDUCTION CUT INVERTED SUM Irreducible Plane Curves Jason E. Durham æ Oregon State University Corvallis, Oregon durhamj@ucs.orst.edu August 4, 1999 Abstract Progress in the classiæcation of plane curves in the last æve years has

More information

Unit 3 (Part-I): Greedy Algorithms

Unit 3 (Part-I): Greedy Algorithms Unit 3 (Part-I): Greedy Algorithms Expected Outcomes of topic (CO) Understand problem and its formulation to design an algorithm Demonstrate the knowledge of basic data structures and their implementation

More information

Chapter 23. Minimum Spanning Trees

Chapter 23. Minimum Spanning Trees Chapter 23. Minimum Spanning Trees We are given a connected, weighted, undirected graph G = (V,E;w), where each edge (u,v) E has a non-negative weight (often called length) w(u,v). The Minimum Spanning

More information

Test 1 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. 2 points each t 1

Test 1 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. 2 points each t 1 CSE 0 Name Test Fall 00 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each t. What is the value of k? k=0 A. k B. t C. t+ D. t+ +. Suppose that you have

More information

D. Θ nlogn ( ) D. Ο. ). Which of the following is not necessarily true? . Which of the following cannot be shown as an improvement? D.

D. Θ nlogn ( ) D. Ο. ). Which of the following is not necessarily true? . Which of the following cannot be shown as an improvement? D. CSE 0 Name Test Fall 00 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to convert an array, with priorities stored at subscripts through n,

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

n 2 ( ) ( ) Ο f ( n) ( ) Ω B. n logn Ο

n 2 ( ) ( ) Ο f ( n) ( ) Ω B. n logn Ο CSE 220 Name Test Fall 20 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. 4 points each. The time to compute the sum of the n elements of an integer array is in:

More information

Practice Exam #3, Math 100, Professor Wilson. MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Practice Exam #3, Math 100, Professor Wilson. MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. Practice Exam #3, Math 100, Professor Wilson MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) A tree is A) any graph that is connected and every

More information

Minimum spanning trees

Minimum spanning trees Carlos Moreno cmoreno @ uwaterloo.ca EI-3 https://ece.uwaterloo.ca/~cmoreno/ece5 Standard reminder to set phones to silent/vibrate mode, please! During today's lesson: Introduce the notion of spanning

More information

NP-Completeness. Algorithms

NP-Completeness. Algorithms NP-Completeness Algorithms The NP-Completeness Theory Objective: Identify a class of problems that are hard to solve. Exponential time is hard. Polynomial time is easy. Why: Do not try to find efficient

More information

Sample Solutions to Homework #4

Sample Solutions to Homework #4 National Taiwan University Handout #25 Department of Electrical Engineering January 02, 207 Algorithms, Fall 206 TA: Zhi-Wen Lin and Yen-Chun Liu Sample Solutions to Homework #4. (0) (a) Both of the answers

More information

The exam is open book; any written materials may be used, as well as on-line or

The exam is open book; any written materials may be used, as well as on-line or CS145 Midterm Examination Thursday, November 4, 2004, 2:45 í 4PM Directions The exam is open book; any written materials may be used, as well as on-line or electronically stored materials. However, it

More information

Spanning Trees, greedy algorithms. Lecture 20 CS2110 Fall 2018

Spanning Trees, greedy algorithms. Lecture 20 CS2110 Fall 2018 1 Spanning Trees, greedy algorithms Lecture 20 CS2110 Fall 2018 1 About A6, Prelim 2 Prelim 2: Thursday, 15 November. Visit exams page of course website and read carefully to find out when you take it

More information

10/31/18. About A6, Prelim 2. Spanning Trees, greedy algorithms. Facts about trees. Undirected trees

10/31/18. About A6, Prelim 2. Spanning Trees, greedy algorithms. Facts about trees. Undirected trees //8 About A, Prelim Spanning Trees, greedy algorithms Lecture CS Fall 8 Prelim : Thursday, November. Visit exams page of course website and read carefully to find out when you take it (: or 7:) and what

More information

CMSC351 - Fall 2014, Homework #6

CMSC351 - Fall 2014, Homework #6 CMSC351 - Fall 2014, Homework #6 Due: December 12th at the start of class PRINT Name: Grades depend on neatness and clarity. Write your answers with enough detail about your approach and concepts used,

More information

k 1234 k-nodes k 12 k 234 k 4 k 1 k 2 k 3 u 3 u 4 u 1 u 2 u-nodes

k 1234 k-nodes k 12 k 234 k 4 k 1 k 2 k 3 u 3 u 4 u 1 u 2 u-nodes Secure Group Communications Using Key Graphs æ Chung Kei Wong Mohamed Gouda Simon S. Lam Department of Computer Sciences University of Texas at Austin Austin, TX 787-88 fckwong,gouda,lamg@cs.utexas.edu

More information

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018 CS 4 Section # Shortest Paths and MSTs //08 Shortest Paths There are types of shortest paths problems: Single source single destination Single source to all destinations All pairs shortest path In today

More information

Shortest path problems

Shortest path problems Next... Shortest path problems Single-source shortest paths in weighted graphs Shortest-Path Problems Properties of Shortest Paths, Relaxation Dijkstra s Algorithm Bellman-Ford Algorithm Shortest-Paths

More information

Student Name and ID Number. MATH 3012, Quiz 3, April 16, 2018, WTT

Student Name and ID Number. MATH 3012, Quiz 3, April 16, 2018, WTT MATH 3012, Quiz 3, April 16, 2018, WTT Student Name and ID Number 1. A graph with weights on edges is shown below. In the space to the right of the figure, list in order the edges which make up a minimum

More information

In this lecture, we ll look at applications of duality to three problems:

In this lecture, we ll look at applications of duality to three problems: Lecture 7 Duality Applications (Part II) In this lecture, we ll look at applications of duality to three problems: 1. Finding maximum spanning trees (MST). We know that Kruskal s algorithm finds this,

More information

Computing the Median with Uncertainty. Jennifer Widom í. be pinned-down as desired regardless of the results of the. queries.

Computing the Median with Uncertainty. Jennifer Widom í. be pinned-down as desired regardless of the results of the. queries. Computing the Median with Uncertainty Tomas Feder æ Rajeev Motwani y Rina Panigrahy z Chris Olston x Jennifer Widom í Abstract We consider a new model for computing with uncertainty. It is desired to compute

More information

NP and computational intractability. Kleinberg and Tardos, chapter 8

NP and computational intractability. Kleinberg and Tardos, chapter 8 NP and computational intractability Kleinberg and Tardos, chapter 8 1 Major Transition So far we have studied certain algorithmic patterns Greedy, Divide and conquer, Dynamic programming to develop efficient

More information