Combinatorial Algorithms - Midterm Exam - Fall 2003 | CS 373, Exams of Computer Science

Material Type: Exam; Class: Theory of Computation; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Spring 2003;

Typology: Exams

Pre 2010

Uploaded on 03/16/2009

koofers-user-aod
koofers-user-aod 🇺🇸

5

(1)

9 documents

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 373: Combinatorial Algorithms, Spring 2003
Midterm 2 April 8, 2003
Name:
Net ID: Alias: U G
This is a closed-book, closed-notes, open-brain exam. If you brought anything with you
besides writing instruments and your
handwritten 81
2
00 ×1100
cheat sheet, please leave it at
the front of the classroom.
Print your name, netid, and alias in the boxes above. Circle
U
if you are an undergrad, or
G
if you are a grad student. Print your name at the top of every page (in case the staple falls
out!).
You should answer all the questions on the exam.
The last few pages of this booklet are blank. Use that for a scratch paper. Please let us know
if you need more paper.
If your cheat sheet if not hand written by yourself, or it is photocopied, please do not use it
and leave it in front of the classroom.
Please submit your cheat sheet together with your exam. An exam without your cheat sheet
attached to it will not be checked.
If you are NOT using a cheat sheet you should indicate it in large friendly letters on this
page.
The total number of points given for \I dont know" answers, will not exceed
10
.
Write short and concise answers. Long and tedious answers will not be graded
and will get grade zero automatically.
Time limit: 75 minutes.
Relax. The semester is almost over...
# Score IDK Score Grader
1.
2.
3.
4.
Total
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Combinatorial Algorithms - Midterm Exam - Fall 2003 | CS 373 and more Exams Computer Science in PDF only on Docsity!

CS 373: Combinatorial Algorithms, Spring 2003

Midterm 2 — April 8, 2003

Name:

Net ID: Alias: U G

ˆ This is a closed-book, closed-notes, open-brain exam. If you brought anything with you besides writing instruments and your handwritten 8 12 ′′^ × 11 ′′^ cheat sheet, please leave it at the front of the classroom.

ˆ Print your name, netid, and alias in the boxes above. Circle U if you are an undergrad, or G if you are a grad student. Print your name at the top of every page (in case the staple falls out!).

ˆ You should answer all the questions on the exam.

ˆ The last few pages of this booklet are blank. Use that for a scratch paper. Please let us know if you need more paper.

ˆ If your cheat sheet if not hand written by yourself, or it is photocopied, please do not use it and leave it in front of the classroom.

ˆ Please submit your cheat sheet together with your exam. An exam without your cheat sheet attached to it will not be checked.

ˆ If you are NOT using a cheat sheet you should indicate it in large friendly letters on this page.

ˆ The total number of points given for \I dont know" answers, will not exceed 10.

ˆ Write short and concise answers. Long and tedious answers will not be graded

and will get grade zero automatically.

ˆ Time limit: 75 minutes.

ˆ Relax. The semester is almost over...

# Score IDK Score Grader

Total

  1. Sort those Numbers [25 Points] You had decided to build a sorting network, and you bought enough gates from your sup- plier Cheap Gates. Unfortunately, instead of the high quality comparators you expected, you got random comparators. Formally, a random comparator, receives two inputs, and with probability half, do nothing (i.e., passes the inputs directly to the outputs), and with proba- bility half, it works correctly outputting the maximum number on the max output, and the minimum on the min output. Describe a construction of a sorting network, that uses only random comparators, and sort correctly the n inputs, with probability ≥ 1 − 1 /n. How many gates does your sorting network have? Provide a proof that your sorting network works with this required con dence.
  1. Almost Magic Square [25 Points] You are asked to ll the entries of an n × n matrix A by integers between 0 and a bound k, so that the sum of all entries in each row, and each column, comes to one of 2 n numbers prespeci ed in advance. For example, the following instance 17 5 4 6 (?? ?) 9 (?? ?) 11 (?? ?) with k = 9 has a solution 17 5 4 6 (6 0 0) 9 (2 3 4) 11 (9 2 0) Assume that the sum of the rows be speci ed in an array R[1..n], and the sum of the columns speci ed in an array C[1..n].

A. [15 Points] Formulate this problem as a network ow problem. B. [10 Points] Write an algorithm for this problem and analyze its running time.