Fall 2007, Final Exam, Data Structures and Algorithms

Similar documents
DEPARTMENT OF HOUSING AND URBAN DEVELOPMENT. [Docket No. FR-6090-N-01]

Telecommunications and Internet Access By Schools & School Districts

Panelists. Patrick Michael. Darryl M. Bloodworth. Michael J. Zylstra. James C. Green

Figure 1 Map of US Coast Guard Districts... 2 Figure 2 CGD Zip File Size... 3 Figure 3 NOAA Zip File Size By State...

A New Method of Using Polytomous Independent Variables with Many Levels for the Binary Outcome of Big Data Analysis

CostQuest Associates, Inc.

2018 NSP Student Leader Contact Form

Ocean Express Procedure: Quote and Bind Renewal Cargo

B.2 Measures of Central Tendency and Dispersion

The Lincoln National Life Insurance Company Universal Life Portfolio

Distracted Driving- A Review of Relevant Research and Latest Findings

DSC 201: Data Analysis & Visualization

MERGING DATAFRAMES WITH PANDAS. Appending & concatenating Series

NSA s Centers of Academic Excellence in Cyber Security

MAKING MONEY FROM YOUR UN-USED CALLS. Connecting People Already on the Phone with Political Polls and Research Surveys. Scott Richards CEO

2018 Supply Cheat Sheet MA/PDP/MAPD

THE LINEAR PROBABILITY MODEL: USING LEAST SQUARES TO ESTIMATE A REGRESSION EQUATION WITH A DICHOTOMOUS DEPENDENT VARIABLE

Accommodating Broadband Infrastructure on Highway Rights-of-Way. Broadband Technology Opportunities Program (BTOP)

State IT in Tough Times: Strategies and Trends for Cost Control and Efficiency

Global Forum 2007 Venice

ACCESS PROCESS FOR CENTRAL OFFICE ACCESS

Department of Business and Information Technology College of Applied Science and Technology The University of Akron

Presented on July 24, 2018

CSE 781 Data Base Management Systems, Summer 09 ORACLE PROJECT

Tina Ladabouche. GenCyber Program Manager

Post Graduation Survey Results 2015 College of Engineering Information Networking Institute INFORMATION NETWORKING Master of Science

IT Modernization in State Government Drivers, Challenges and Successes. Bo Reese State Chief Information Officer, Oklahoma NASCIO President

Moonv6 Update NANOG 34

Silicosis Prevalence Among Medicare Beneficiaries,

Team Members. When viewing this job aid electronically, click within the Contents to advance to desired page. Introduction... 2

Name: Business Name: Business Address: Street Address. Business Address: City ST Zip Code. Home Address: Street Address

Charter EZPort User Guide

Prizm. manufactured by. White s Electronics, Inc Pleasant Valley Road Sweet Home, OR USA. Visit our site on the World Wide Web

The Outlook for U.S. Manufacturing

Best Practices in Rapid Deployment of PI Infrastructure and Integration with OEM Supplied SCADA Systems

2015 DISTRACTED DRIVING ENFORCEMENT APRIL 10-15, 2015

AASHTO s National Transportation Product Evaluation Program

CIS 467/602-01: Data Visualization

What Did You Learn? Key Terms. Key Concepts. 68 Chapter P Prerequisites

A Capabilities Presentation

Amy Schick NHTSA, Occupant Protection Division April 7, 2011

Presentation Outline. Effective Survey Sampling of Rare Subgroups Probability-Based Sampling Using Split-Frames with Listed Households

Sideseadmed (IRT0040) loeng 4/2012. Avo

PulseNet Updates: Transitioning to WGS for Reference Testing and Surveillance

Contact Center Compliance Webinar Bringing you the ANSWERS you need about compliance in your call center.

Expanding Transmission Capacity: Options and Implications. What role does renewable energy play in driving transmission expansion?

CMPE 180A Data Structures and Algorithms in C++ Spring 2018

Touch Input. CSE 510 Christian Holz Microsoft Research February 11, 2016

DTFH61-13-C Addressing Challenges for Automation in Highway Construction

Presentation to NANC. January 22, 2003

CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018

Homework Assignment #5

State HIE Strategic and Operational Plan Emerging Models. February 16, 2011

Medium voltage Marketing contacts

Panasonic Certification Training January 21-25, 2019

Recitation 9. Prelim Review

Steve Stark Sales Executive Newcastle

Second Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms...

Geographic Accuracy of Cell Phone RDD Sample Selected by Area Code versus Wire Center

CS 251, LE 2 Fall MIDTERM 2 Tuesday, November 1, 2016 Version 00 - KEY

CS 3343 (Spring 2013) Exam 2

Strengthening connections today, while building for tomorrow. Wireless broadband, small cells and 5G

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

Data Visualization (CIS/DSC 468)

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

Selling Compellent Hardware: Controllers, Drives, Switches and HBAs Chad Thibodeau

CSE100 Practice Final Exam Section C Fall 2015: Dec 10 th, Problem Topic Points Possible Points Earned Grader

Jurisdictional Guidelines for Accepting a UCC Record Presented for Filing 2010 Amendments & the 2011 IACA Forms

CSE 332 Spring 2014: Midterm Exam (closed book, closed notes, no calculators)

Today s Lecture. Factors & Sampling. Quick Review of Last Week s Computational Concepts. Numbers we Understand. 1. A little bit about Factors

Azure App Service. Jorge D. Wong Technical Account Manager Microsoft Azure. Ingram Micro Inc.

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?

Solutions to Exam Data structures (X and NV)

How to Make an Impressive Map of the United States with SAS/Graph for Beginners Sharon Avrunin-Becker, Westat, Rockville, MD

On All Forms. Financing Statement (Form UCC1) Statutory, MARS or Other Regulatory Authority to Deviate

CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators)

Student number: Datenstrukturen & Algorithmen page 1

Using a Probabilistic Model to Assist Merging of Large-scale Administrative Records

Data Structures Brett Bernstein

STATE DATA BREACH NOTIFICATION LAWS OVERVIEW OF REQUIREMENTS FOR RESPONDING TO A DATA BREACH UPDATED JUNE 2017

Real World Algorithms: A Beginners Guide Errata to the First Printing

END-TERM EXAMINATION

Configuring Oracle GoldenGate OGG 11gR2 local integrated capture and using OGG for mapping and transformations

OPERATOR CERTIFICATION

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)

ECE242 Data Structures and Algorithms Fall 2008

Unit 7 Day 5 Graph Theory. Section 5.1 and 5.2

MST worksheet By Jim Xu

ASR Contact and Escalation Lists

2013 Product Catalog. Quality, affordable tax preparation solutions for professionals Preparer s 1040 Bundle... $579

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer)

Solutions to Midterm 2 - Monday, July 11th, 2009

Homework Assignment #3 Graph

Final Examination CSE 100 UCSD (Practice)

Configuration Principles with Object Dependencies

Paralleling Topologies and Uptime Institute Tier Ratings

CS 61B Summer 2005 (Porter) Midterm 2 July 21, SOLUTIONS. Do not open until told to begin

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

The Altice Business. Carrier Advantage

Welcome to the Comcast Business SmartOffice Video Monitoring Solution

Transcription:

Fall 2007, Final Exam, Data Structures and Algorithms Name: Section: Email id: 12th December, 2007 This is an open book, one crib sheet (2 sides), closed notebook exam. Answer all twelve questions. Each Question is worth 10 points. You have 180 minutes to complete the exam. Happy Holidays and Have a Great New Leap Year. The formulas you need are: i=n i=0 i=n i=0 1 Formulas i=n i=0 i = n(n + 1)/2. i 2 = n(n + 1)(2n + 1)/6. a i = (1 a n+1 )/(1 a), where a 1. 1

1. Graphs/DFS/Path The 49 postal codes in USA (48 continental states and Washington DC) are AL, AR, AZ, CA, CO, CT, DC, DE, FL, GA. IA, ID, IL, IN, KS, KY, LA, MA, MD, ME, MI, MN, MO, MS, MT, NC, ND, NE, NH, NJ, NM, NV, NY, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VA, VT, WA, WI, WV, WY, in alphabetical order. Suppose we consider two states be adjacent if their postal codes agree in one place (Constructing an undirected graph with 49 states as vertices/nodes and the edges are defined as given above- However, you need not construct the graph to answer the questions below.).[10 points] (a) What is the degree of vertex/node NY? (b) Write a path of length 2 from CA to NY. (c) Write the paths (any length is acceptable) from AZ to ME, WA to SC and WA to FL. (d) Is the graph Connected? 2

2. Shortest Path Algorithms/Spanning Tree Here is a map of United States. as an undirected graph with adjacent states connected by an edge. [10 Points] (a) what is the shortest path from ND to SC (using Dijkstra s algorithm for unweighted graphs) (b) Give two different paths which are edge disjoint from NY to CA. (c) Draw DFS Spanning tree starting at NY (d) Draw a BFS Spanning tree starting at NY. 3

3. Eulerian Cycles, Topological Sort (a) Draw a simple connected directed graph with 8 vertices and 16 edges such that the in-degree and out-degree of each vertex is 2. Show that there is an Eulerian Cycle by listing the cycle.[5 Points] (b) Mr. Kay loves foreign languages and wants to plan his course schedule to take the following nine language courses: LA15, LA16, LA22, LS31, LA32,LA126,LA127,LA141 and LA169. The course prerequisites are LA15: (none) LA16: LA15 LA22: (none) LA31: LA15 LA32: LA16,LA31 LA126: LA22,LA32 LA127: LA16 LA141: LA22,LA16 LA169: LA32 Find a sequence of courses that allows Bob to satisfy all the prerequisites.[5 Points] 4

5

6

4. Network Flows Consider the following network (the numbers are edge capacities).[10 Points] (a) Find the maximum flow, f, from S to T (b) Draw the residual graph G f (along with edge capacities). In this residual network, mark the vertices reachable from S and the vertices from which T is reachable. (c) An edge in a network is a bottleneck edge if increasing its capacity results in an increase in the maximum flow. List ll bottleneck edges in the above network. (d) Give a very simple example (containing at most 4 nodes/vertices) of a network which has no bottleneck edges. 7

5. Dynamic Programming/Dijkstra Yuckdonald s is considering opening a series of restaurants along Judson Valley Highway (JVH). The n possible location are along a straight line, and the distances of these locations from the start of JVH are, in miles, and in increasing order m 1,m 2,,m n.the constraints are as follows: At each location, Yuckdonald s may open at most one restaurant. The expected profit from opening a restaurant at location i is p i, where p i > 0, for i = 1,2,,n. Any two restaurants should be at least k miles apart, where k is a positive integer. Give an efficient algorithm to compute the maximum expected total profit, subject to the given constraints. [10 Points] 8

6. Huffman (a) A long string consists of Characters A, C, G, T.; they appear with frequency 31%.20%,9% and 40% respectively. What is the Huffman encoding of these four characters? [5 Points] (b) We use Huffman s algorithm to obtain the encoding of alphabet {a, b, c} with frequencies f a,f b,f c. In each of the cases, either give an example of frequencies f a,f b,f c that would yield the specified code, or explain why the code cannot be possibly obtained (no matter what the frequencies are) [5 Points] i. Code:{0,10,11} ii. Code: {0,1,00} iii. Code: {10,01,00} 9

7. Analysis, Greedy (a) Give a linear time algorithm that takes input as a tree T and determines whether it has a perfect matching (i.e., a subset of edges of the given tree T) that touches each vertex only once). edges O(n), where n is the number of vertices in a tree.[5 Points] (b) Solve T(n) = T( n ) + n and T(1) = 1. 2 [5 Points] 10

8. Recursion, Search How many lines does the following program print for the function call f(16). Generalize this for f(n), n = 2 k.[5 Points] void f (int n) { if (n > 1) { cout << Still Going << endl; f(n/2); f(n/2); } } (a) Given a sorted array of distinct integers A[1,...n], you want to find an index i, which A[i] = i. (If no such index exists, you may report it too) Give an algorithm that runs in O(log n) time.[5 Points] 11

9. Selection, Median Professor Oiler is consulting for an oil company, which is planning a large pipeline running east to west through an oil field of n wells. The co-ordinates of each well is (x i,y i ). For each well, a spur pipeline is to be connected directly to the main pipeline along a shortest path (either north or south) as shown in the following figure. Given x, y co-ordinates of the wells, how should the professor pick the optimal location of the main pipeline (the one that minimizes the total lengths of the spurs)? Show that the optimal solution can be determined in linear time. The main pipeline is a line parallel to X-axis; i.e., the main pipeline is a horizontal line. For inefficient algorithm will get 5 points. Hint: A median, y m of a set of n numbers {y 1,y 2,,y n } minimizes the sum of absolute difference of y i y m [10 Points] 12

. 10. Heap Sort (a) Is the sequence 23, 17, 14, 6, 13, 10, 1, 5, 7, 12 a max heap? If not convert into a max heap.[4 Points] (b) Where in a max heap of size 12, might the smallest element reside assuming all elements are distinct.[3 Points] (c) What are the minimum and maximum number of elements in a heap of height h? [3 Points] 13

11. Hash Table, Binary Serach Tree (a) Write a recursive algorithm for inserting a key in a Binary Search Tree. [5 Points] (b) Demonstrate the insertion of the keys 5, 28, 19, 15, 20, 33, 12, 17, 10 into a Hash Table of size 9 with collissions resolved by chaining. Let the hash function be h(k) = k mod 9. [5 Points] 14

12. Sorting Give an algorithm (sequences of comparisons) to sort 5 elements with 7 comparisons. (If you take more than 7 comparisons, you will get half the credit.) [5 Points] (a) Sort 3, 1, 4, 1, 5, 9, 2, 6 using merge sort (Show your steps.) [5 Points] 15