midterm-sol

midterm-sol - Midterm 1 lZC‘E (308 t i - x t :1. p...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Midterm 1 lZC‘E (308 t i - x t :1. p _\oveniher 8. 2tlll. 12:()()pin—l:15p1n Name: 51"“ m ‘ Read all of the following information before starting the exam: 0 NOTE: Unanswered questions are worth 25% eredit. rounded down. \\’riting any answer loses this “free” eredit. whieh must he earned hark hy the quality of the answer. It you wish a question to he treated as unanswered. hut you have written on it. elearly write "DO NOT GRADE" in the answer area. In a nuilti—part question. unanswered par/s are worth 25%. 0 Show all work. (“learly and in order. if you want to get full eredit. I reserve the right to take off points il' l ('annot see how you arrived at your answer (even if your final answer is (-orrert). o No ('aleulators. or 111at‘erials other than pen/peneil and hlank paper are allowed exeept those we distribute during the exam. 0 Please keep your written answers hriel': he clear and to the point. l’oints will he dedueted for rainhling‘ and for ineorreet' or irrelevant statements. 0 Prohlenis laheled "short answer only" must he answered with no more than a rea— sonahle sentenee. o This test has live prohleins. eaeh ol'whieh is approximately equal in value. It is your responsihility to make sure that you have all of the pages! 0 Good luekl 1. Let G = (V, E) be a graph. V is the set of vertices and E g V X V is the set of edges in the graph. A cut of the graph is a partition (A, B) of the set of vertices V. (A U B = V and A is disjoint from B.) The number of edges in E that cross the cut. i.e. E H x B) U (B x is called the size of the cut. Suppose an algorithm constructs a random (cut of G by assigning each vertex to A or B uniformly at random (say. by a fair coin flip). Show using a simple indicator variable analysis that the expected size of this random cut is |El/2. 1 lb? edgetiji) l3 in We Cut X E g 0 olhmruiae >< ; it @4- Eotgag in «a; mi"; WEE ‘992 E , \l ' E. \/2— (399’ Nd / sweE \ 2. Sorting a. \Vhat key indicator variables are defined and used in the proof that randoinized quicksort has expected runtinie 0(7'1, lgn)‘ here. i 18 Q/Qernee’t Z L {‘9 aifimfl 13f.“ ' fie amt Con fa ma" i k Define them carefully and thoroughly b. An array of records can be converted into a heap by ensuring the heap prop— erty for the tree—structured view of the array in either a bottom—up or top-down fashion. (Bottom up repeatedly uses heapifyO and top-down repeatedly uses heap-insertO.) Which of these approaches results in a lll()1‘(‘ efficient asymp- totic worst—case runtiine scaling and why? (Your answer inust contrast these two methods qualitatively in addition to giving the asymptotic runtinies for each, but you need not give the formal derivation of the runtiine hounds.) Bottom; LU? OW (l0? ~ JDA/‘f‘ 0M 06W“) am or i vCZan p (\Q. reg,th 1:: 3. Consider a graph G' = (K E) and positive weights on the edges w : E ——> N. Suppose G is undirected (ie. E is symmetric, so that (U711) E E ifl' (mu) 6 A set of edges 1U g E is a minimum spanning tree of G if (1) For every pair of vertices (’u,./ v) there is a path from u to v in A1, and (2) No other set of edges with property (1) has lower total weight than 111. Note that a minimum spanning tree cannot contain any cycles, or some edge can be removed to get a lower—weight spanning tree. Does the problem of finding a minimum spanning tree for G exhibit optimal substructure? (we require only a brief informal argument in support of your answer but it must be completely clear that you understand what optimal substructure means in this problem and how to go about showing it.) minimum Wmlq M93 Xubfebg (Mo chart-i) ant! (.u/V) fivm The, “(500 owl/73'?- {L37- G‘ (5)2. by YEMOVtrj +2193 am c m3 id 0 fl '8 W «(8min {(3) 43513 {QR , 0’? G) We“ . u ;..‘31\ . q .L:§L ' "j ( we C01,“ UR (2m; Sim‘ch‘el‘j %* ’9 “battey Xvarm'rr‘j 9:396. Ml meeoi b5 M1 {paeer ice m cmrmvermvnt 0“ 4. List and explain all assumptions we needed in order to claim that hashing with chaining for collision resolution results in 0(1) expected search time. shower Mn;,(_7©{m HASH/3 — a given Wank: a‘m . , slt ‘0 6W“ M: ba Wheat Lab) mdmf: “We file 05 (fix cfifiwwfa‘ Q2) Constant (owl Facéar L n : om) ) c: L: Wesng 399‘“) ‘— [3) E1“ b0“ gvmfif ‘ - .‘ m0 904991 “CD 5: W21 035 ‘ ‘ Wed Leia/w Fe 51 I \ V£€m 2566900 t rm: (mm I ems” MYC“ Me 6W L i ‘ fie take. ‘ J— o Wm '0 m l _ L) H Sh fwww Com\WZULan 13 OLD L.’ a 5. Argue carefully using mathematical induction that T(n) = 2T(n — 1) + 1 with T(1) : 1 is 0(2" — 1). (VO Wye. TM) g a who 43“ 00/ A; no / 801/38 003%: WU): run)“: 5 '2. 71395 (“—13% —\) Rows {4s can no: £3; _ ‘0‘ \Mpomo‘ir PHIL—'17 é 5— w "3 . mum w: w) 2: ow» W): a "WWW A LLQ“VL\) +1 4 “325:0 H S C @‘4—0 “(C4) {— CIL‘g‘fi) ...
View Full Document

This note was uploaded on 01/10/2012 for the course ECE 565 taught by Professor Pai during the Fall '11 term at Purdue.

Page1 / 6

midterm-sol - Midterm 1 lZC‘E (308 t i - x t :1. p...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online