ds-algo-study
Version:
Just experimenting with publishing a package
24 lines (18 loc) • 401 B
JavaScript
var Set = function() {
var set = Object.create(setPrototype);
set._storage = undefined;
return set;
};
var setPrototype = {};
setPrototype.add = function(item) {
this[item] = item;
};
setPrototype.contains = function(item) {
return !!this[item];
};
setPrototype.remove = function(item) {
delete this[item];
};
/*
* Complexity: What is the time complexity of the above functions?
*/