140 likes | 263 Vues
This document presents a series of problems and their solutions related to computational algorithms and data manipulation techniques. Each problem outlines specific scenarios, methodologies, and approaches to arrive at effective solutions. The problems span a variety of topics, including mapping, reducing datasets, and managing graph states. Insights on the operations performed during data processing, as well as logical constructs used to determine the relationships in data, are also discussed. It's a concise yet comprehensive guide for understanding the problem-solving frameworks in computer science.
E N D
Problem 1 Solution • (a) True • (b) True • (c) False • (d) False • (e) False • (f) True • (g) False • (h) False • (i) True • (j) True
Problem 2 Solution • (a) 5 • (b) 2T - 1 • (c) 4T - 4 • (d) 4T - 4
Problem 3 Solution • (a) map(t) if t.A < 10 emit(0, t) Reduce(key, val) for each v in val emit(v)
Problem 3 Solution • (b) map(t) emit(t.B, t.B) Reduce(key, val) emit(“X”, key)
Problem 3 Solution • (c) map(t) emit(t.B, t) Reduce(key, val) for each r in val for each s in val if r.rel=“R” and s.rel=“S” emit(“X”, r.A, r.B, s.C)
Problem 4 Solution • (b)
Problem 4 Solution • (c)
Problem 5 Solution • (a) G1 • G2
Problem 5 Solution • (b)
Problem 6 Solution • (a) N33 • (b) N1 • (c)
Problem 6 Solution • (d)
Problem 6 Solution • (e)
Problem 6 Solution • (f)
Problem 7 Solution • Blank 1 MyState.diam := w.diam • Blank 2 MyState.dist := w.dist + 1 • Blank 3 MyState.thru:= f • Blank 4 if MyState.dist > MyState.diam then MyState.diam := MyState.dist