Improve intersecting group behavior

This commit is contained in:
Ian Gulliver
2019-07-09 17:30:09 +00:00
parent 6e82a8a78b
commit b44a9d40a7
3 changed files with 26 additions and 11 deletions

View File

@@ -25,5 +25,15 @@ function intersects(set1, set2) {
return false;
}
function asymDifference(set1, set2) {
let ret = new Set();
for (let item of set1) {
if (!set2.has(item)) {
ret.add(item);
}
}
return ret;
}
<!--# include file="MinHeap.js" -->
<!--# include file="StringMap.js" -->