Time Measurement

Simple Clock

13:05:59

Set Intersection

Question 3 in 2018 exam
Data contains 189314 chars, 3129 lines
3129 students, 1135 distinct names


Sample code

function intersect1(a, b) { //fast
let s = new Set()
for (let x of a)
if (b.has(x)) s.add(x)
return s
}
function intersect2(a, b) { //slow
let s = new Set()
for (let x of a)
for (let y of b)
if (x == y) s.add(x)
return s
}