forked from EddieCornelious/js_data-collections
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollections.min.js
1 lines (1 loc) · 49.3 KB
/
collections.min.js
1
(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define("Collections",[],factory);else if(typeof exports==="object")exports["Collections"]=factory();else root["Collections"]=factory()})(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:false};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.loaded=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;exports.MultiMap=exports.RBTree=exports.Set=exports.ArrayUtils=exports.Trie=exports.Graph=exports.BST=exports.HashSet=exports.HashMap=exports.PriorityQueue=exports.BHeap=exports.Queue=exports.Stack=exports.List=undefined;var _List=__webpack_require__(1);var _List2=_interopRequireDefault(_List);var _Stack=__webpack_require__(3);var _Stack2=_interopRequireDefault(_Stack);var _Queue=__webpack_require__(4);var _Queue2=_interopRequireDefault(_Queue);var _BHeap=__webpack_require__(5);var _BHeap2=_interopRequireDefault(_BHeap);var _PriorityQueue=__webpack_require__(6);var _PriorityQueue2=_interopRequireDefault(_PriorityQueue);var _HashMap=__webpack_require__(7);var _HashMap2=_interopRequireDefault(_HashMap);var _HashSet=__webpack_require__(9);var _HashSet2=_interopRequireDefault(_HashSet);var _BST=__webpack_require__(11);var _BST2=_interopRequireDefault(_BST);var _Graph=__webpack_require__(14);var _Graph2=_interopRequireDefault(_Graph);var _Trie=__webpack_require__(16);var _Trie2=_interopRequireDefault(_Trie);var _ArrayUtils=__webpack_require__(17);var _ArrayUtils2=_interopRequireDefault(_ArrayUtils);var _RedBlackTree=__webpack_require__(15);var _RedBlackTree2=_interopRequireDefault(_RedBlackTree);var _Set=__webpack_require__(18);var _Set2=_interopRequireDefault(_Set);var _MultiMap=__webpack_require__(19);var _MultiMap2=_interopRequireDefault(_MultiMap);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.List=_List2["default"];exports.Stack=_Stack2["default"];exports.Queue=_Queue2["default"];exports.BHeap=_BHeap2["default"];exports.PriorityQueue=_PriorityQueue2["default"];exports.HashMap=_HashMap2["default"];exports.HashSet=_HashSet2["default"];exports.BST=_BST2["default"];exports.Graph=_Graph2["default"];exports.Trie=_Trie2["default"];exports.ArrayUtils=_ArrayUtils2["default"];exports.Set=_Set2["default"];exports.RBTree=_RedBlackTree2["default"];exports.MultiMap=_MultiMap2["default"]},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _Util=__webpack_require__(2);function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function getNode(index){var head=this.head;if(index<0||!head){return}var i=0;while(i<index){head=head.next;i+=1;if(!head){return}}return head}var Node=function Node(data){_classCallCheck(this,Node);this.data=data;this.next=null;this.prev=null};var List=function(){function List(){_classCallCheck(this,List);this.head=null;this.tail=null;this.length=0}List.prototype.addToFront=function addToFront(data){var head=this.head,length=this.length;var newNode=new Node(data);if(!head){this.head=newNode;this.tail=this.head}else{this.head=newNode;newNode.next=head;head.prev=newNode}this.length=length+1;return this};List.prototype.elementAtIndex=function elementAtIndex(){var index=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var foundNode=getNode.call(this,index);return foundNode?foundNode.data:undefined};List.prototype.addToBack=function addToBack(data){var tail=this.tail,length=this.length;var newNode=new Node(data);if(!tail){this.head=newNode;this.tail=this.head}else{this.tail=newNode;newNode.prev=tail;tail.next=newNode}this.length=length+1;return this};List.prototype.removeFront=function removeFront(){var head=this.head,length=this.length;var removedData=void 0;if(head){removedData=head.data;this.length=length-1;this.head=head.next;var newHead=this.head;if(!newHead){this.tail=null;this.head=this.tail}else{newHead.prev=null}}return removedData};List.prototype.removeBack=function removeBack(){var tail=this.tail,length=this.length;var removedData=void 0;if(tail){removedData=tail.data;var prev=tail.prev;this.length=length-1;if(!prev){this.tail=null;this.head=this.tail}else{prev.next=null;this.tail=prev}}return removedData};List.prototype.insert=function insert(){var index=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var data=arguments[1];var length=this.length;if(index===0){return this.addToFront(data)}else if(index>=length){return this.addToBack(data)}var parentNode=getNode.call(this,index-1);if(parentNode){var newNode=new Node(data);var oldParentNext=parentNode.next;newNode.next=oldParentNext;oldParentNext.prev=newNode;parentNode.next=newNode;newNode.prev=parentNode;this.length=length+1}return this};List.prototype.remove=function remove(index){var length=this.length;var removedData=void 0;if(index===0){return this.removeFront()}else if(index>=length-1){return this.removeBack()}var parentNode=getNode.call(this,index-1);if(parentNode){var toRemove=parentNode.next;removedData=toRemove.data;var toRemoveNext=toRemove.next;parentNode.next=toRemoveNext;toRemoveNext.prev=parentNode;this.length=length-1}return removedData};List.prototype.indexOf=function indexOf(data,comparator){var cmp=comparator||_Util.defaultComparator;var index=0;var head=this.head;while(head){if(cmp(data,head.data)===0){return index}head=head.next;index+=1}return-1};List.prototype.contains=function contains(data,comparator){return this.indexOf(data,comparator)!==-1};List.prototype.clear=function clear(){this.head=null;this.tail=null;this.length=0};List.prototype.size=function size(){return this.length};List.prototype.forEach=function forEach(predicate){var head=this.head;var index=0;while(head){predicate(head.data,index);head=head.next;index+=1}return this};List.prototype.filter=function filter(predicate){var head=this.head;var newList=new List;var data=void 0;while(head){data=head.data;if(predicate(data)){newList.addToBack(data)}head=head.next}return newList};List.prototype.every=function every(predicate){var head=this.head;while(head){if(!predicate(head.data)){return false}head=head.next}return true};List.prototype.some=function some(predicate){var head=this.head;while(head){if(predicate(head.data)){return true}head=head.next}return false};List.prototype.toArray=function toArray(){var temp=[];this.forEach(function(element){return temp.push(element)});return temp};return List}();exports["default"]=List},function(module,exports){"use strict";exports.__esModule=true;var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.swap=swap;exports.flat=flat;exports.toString=toString;exports.defaultComparator=defaultComparator;exports.isNumber=isNumber;exports.generateRandomInt=generateRandomInt;function swap(array,index1,index2){var oldIndex1=array[index1];array[index1]=array[index2];array[index2]=oldIndex1}function flat(array,res){var newArr=[];var curValue=void 0;for(var i=0,len=array.length;i<len;i+=1){curValue=array[i];if(Array.isArray(curValue)){flat(curValue,res)}else{res.push(curValue)}}return newArr}function toString(value){var type=typeof value==="undefined"?"undefined":_typeof(value);if(type==="string"){return value}else if(type==="number"||type==="boolean"||type==="function"){return value.toString()}return JSON.stringify(value)}function defaultComparator(a,b){if(a<b){return-1}if(a===b){return 0}return 1}function customComparator(a,b){if(a<b){return-1}if(a===b){return 0}return 1}function isNumber(value){if(typeof value!=="number"||!isFinite(value)){throw new TypeError("Argument must be of type number or Number")}}function generateRandomInt(limit){return Math.floor(Math.random()*limit)}},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _List=__webpack_require__(1);var _List2=_interopRequireDefault(_List);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var Stack=function(){function Stack(){_classCallCheck(this,Stack);this.stack=new _List2["default"]}Stack.prototype.push=function push(data){this.stack.addToFront(data);return this};Stack.prototype.pop=function pop(){return this.stack.removeFront()};Stack.prototype.peek=function peek(){return this.stack.elementAtIndex(0)};Stack.prototype.clear=function clear(){return this.stack.clear()};Stack.prototype.size=function size(){return this.stack.size()};return Stack}();exports["default"]=Stack},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _List=__webpack_require__(1);var _List2=_interopRequireDefault(_List);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var Queue=function(){function Queue(){_classCallCheck(this,Queue);this.queue=new _List2["default"]}Queue.prototype.enqueue=function enqueue(data){this.queue.addToBack(data);return this};Queue.prototype.dequeue=function dequeue(){return this.queue.removeFront()};Queue.prototype.peek=function peek(){return this.queue.elementAtIndex(0)};Queue.prototype.clear=function clear(){return this.queue.clear()};Queue.prototype.size=function size(){return this.queue.size()};return Queue}();exports["default"]=Queue},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _Util=__webpack_require__(2);function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function heapify(array,index,comparator){var leftChildIndex=2*index;var rightChildIndex=2*index+1;var numIndicies=array.length-1;var largest=void 0;if(leftChildIndex<=numIndicies&&comparator(array[leftChildIndex],array[index])===1){largest=leftChildIndex}else{largest=index}if(rightChildIndex<=numIndicies&&comparator(array[rightChildIndex],array[largest])===1){largest=rightChildIndex}if(largest!==index){(0,_Util.swap)(array,index,largest);heapify(array,largest,comparator)}}function siftUp(array,index,comparator){if(index>1){var parent=Math.floor(index/2);if(comparator(array[parent],array[index])===-1){(0,_Util.swap)(array,parent,index);siftUp(array,parent,comparator)}}}var BHeap=function(){function BHeap(comparator){_classCallCheck(this,BHeap);this.heap=[null];this.comparator=comparator||_Util.defaultComparator}BHeap.prototype.extractRoot=function extractRoot(){var heap=this.heap,comparator=this.comparator;var max=heap[1];heap[1]=heap[heap.length-1];heap.length-=1;heapify(heap,1,comparator);return max};BHeap.prototype.insert=function insert(data){var heap=this.heap,comparator=this.comparator;heap[heap.length]=data;siftUp(heap,heap.length-1,comparator);return this};BHeap.prototype.contains=function contains(data){return this.toArray().indexOf(data)!==-1};BHeap.prototype.peek=function peek(){return this.heap[1]};BHeap.prototype.toArray=function toArray(){return this.heap.slice(1)};BHeap.prototype.size=function size(){return this.heap.length-1};BHeap.prototype.clear=function clear(){this.heap.length=1};return BHeap}();exports["default"]=BHeap},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _BHeap=__webpack_require__(5);var _BHeap2=_interopRequireDefault(_BHeap);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function minHeapComparator(objectA,objectB){if(objectA.priority<objectB.priority){return 1}if(objectA.priority===objectB.priority){return 0}return-1}var PriorityQueue=function(){function PriorityQueue(){_classCallCheck(this,PriorityQueue);this.queue=new _BHeap2["default"](minHeapComparator)}PriorityQueue.prototype.enqueue=function enqueue(data,priority){return this.queue.insert({data:data,priority:priority})};PriorityQueue.prototype.dequeue=function dequeue(){var queue=this.queue;return queue.extractRoot().data};PriorityQueue.prototype.size=function size(){return this.queue.size()};PriorityQueue.prototype.clear=function clear(){return this.queue.clear()};return PriorityQueue}();exports["default"]=PriorityQueue},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _HashTable=__webpack_require__(8);var _HashTable2=_interopRequireDefault(_HashTable);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var HashMap=function(){function HashMap(initialCapacity){_classCallCheck(this,HashMap);this.map=new _HashTable2["default"](initialCapacity)}HashMap.prototype.put=function put(key,value){var self=this;self.map.put(key,value);return self};HashMap.prototype.getVal=function getVal(key){return this.map.getVal(key)};HashMap.prototype.clear=function clear(){return this.map.clear()};HashMap.prototype.remove=function remove(key){return this.map.remove(key)};HashMap.prototype.keys=function keys(){return this.map.keys()};HashMap.prototype.values=function values(){return this.map.values()};HashMap.prototype.contains=function contains(key){return this.map.contains(key)};HashMap.prototype.size=function size(){return this.map.size()};return HashMap}();exports["default"]=HashMap},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};var _Util=__webpack_require__(2);function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function hashString(string){var hash=0;for(var i=0,len=string.length;i<len;i+=1){hash=31*hash+string.charCodeAt(i)|0}return hash}function mod(dividend,divisor){var modulo=dividend%divisor;return dividend<0?modulo*-1:modulo}function createTable(size){var newTable=[];for(var i=0;i<size;i+=1){newTable.push([])}return newTable}function getLocationInTable(key,table){var keyHash=hashString((0,_Util.toString)(key)+(typeof key==="undefined"?"undefined":_typeof(key)));return mod(keyHash,table.length)}function insert(key,value,table){var location=getLocationInTable(key,table);var bucket=table[location];return bucket.push(key,value)}function getKeysOrValues(query,table){var start=query==="keys"?0:1;var result=[];var tableLen=table.length;for(var i=0;i<tableLen;i+=1){var currentBucket=table[i];for(var j=start;j<currentBucket.length;j+=2){result.push(currentBucket[j])}}return result}function search(key,table){var location=getLocationInTable(key,table);var bucket=table[location];for(var index=0;index<bucket.length;index+=2){if(key===bucket[index]){return{bucket:bucket,index:index}}}return{bucket:undefined,index:-1}}function shouldRehash(inserts,table){var load=inserts/table.length;return load>=.75?true:false}var HashTable=function(){function HashTable(){var initialCapacity=arguments.length>0&&arguments[0]!==undefined?arguments[0]:13;_classCallCheck(this,HashTable);this.inserts=0;this.table=createTable(initialCapacity)}HashTable.prototype.put=function put(){var key=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var value=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var self=this;var table=self.table,inserts=self.inserts;var searchResult=search(key,table);var bucket=searchResult.bucket,index=searchResult.index;if(index===-1){insert(key,value,table);self.inserts+=1;if(shouldRehash(inserts+1,table)){self.rehash()}}else{bucket[index+1]=value}return self};HashTable.prototype.getVal=function getVal(key){var searchResult=search(key,this.table);var bucket=searchResult.bucket,index=searchResult.index;return index!==-1?bucket[index+1]:undefined};HashTable.prototype.remove=function remove(key){var self=this;var searchResult=search(key,self.table);var bucket=searchResult.bucket,index=searchResult.index;if(index!==-1){self.inserts-=1;bucket.splice(index,2);return true}return false};HashTable.prototype.contains=function contains(key){return this.getVal(key)!==undefined};HashTable.prototype.rehash=function rehash(){var oldTable=this.table;var newTable=createTable(oldTable.length*2);var oldLen=oldTable.length;for(var i=0;i<oldLen;i+=1){var currentBucket=oldTable[i];for(var j=0;j<currentBucket.length;j+=2){var oldKey=currentBucket[j];var oldValue=currentBucket[j+1];insert(oldKey,oldValue,newTable)}}oldTable.length=0;this.table=newTable};HashTable.prototype.keys=function keys(){return getKeysOrValues("keys",this.table)};HashTable.prototype.values=function values(){return getKeysOrValues("values",this.table)};HashTable.prototype.tableSize=function tableSize(){return this.table.length};HashTable.prototype.clear=function clear(){var self=this;self.table.length=0;self.inserts=0;self.table=createTable(13)};HashTable.prototype.size=function size(){return this.inserts};return HashTable}();exports["default"]=HashTable},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _HashTable=__webpack_require__(8);var _HashTable2=_interopRequireDefault(_HashTable);var _SetInterface2=__webpack_require__(10);var _SetInterface3=_interopRequireDefault(_SetInterface2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defaults(obj,defaults){var keys=Object.getOwnPropertyNames(defaults);for(var i=0;i<keys.length;i++){var key=keys[i];var value=Object.getOwnPropertyDescriptor(defaults,key);if(value&&value.configurable&&obj[key]===undefined){Object.defineProperty(obj,key,value)}}return obj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?_defaults(subClass,superClass):_defaults(subClass,superClass)}var HashSet=function(_SetInterface){_inherits(HashSet,_SetInterface);function HashSet(initialCapacity){_classCallCheck(this,HashSet);var _this=_possibleConstructorReturn(this,_SetInterface.call(this));_this.set=new _HashTable2["default"](initialCapacity);return _this}HashSet.prototype.add=function add(element){this.set.put(element,1);return this};HashSet.prototype.has=function has(element){return this.set.contains(element)};HashSet.prototype.remove=function remove(element){this.set.remove(element);return this};HashSet.prototype.entries=function entries(){return this.set.keys()};HashSet.prototype.cardinality=function cardinality(){return this.set.size()};HashSet.prototype.union=function union(thatSet){return _SetInterface.prototype.union.call(this,thatSet)};HashSet.prototype.diff=function diff(thatSet){return _SetInterface.prototype.diff.call(this,thatSet)};HashSet.prototype.intersect=function intersect(thatSet){return _SetInterface.prototype.intersect.call(this,thatSet)};return HashSet}(_SetInterface3["default"]);exports["default"]=HashSet},function(module,exports){"use strict";exports.__esModule=true;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var SetInterface=function(){function SetInterface(){_classCallCheck(this,SetInterface)}SetInterface.prototype.add=function add(element){};SetInterface.prototype.diff=function diff(thatSet){var thisKeys=this.entries();var result=[];var thisLen=thisKeys.length;var curElement=void 0;for(var i=0;i<thisLen;i+=1){curElement=thisKeys[i];if(!thatSet.has(curElement)){result.push(curElement)}}return result};SetInterface.prototype.union=function union(thatSet){var thatKeys=thatSet.entries();var self=this;var thisKeys=self.entries();var curElement=void 0;var thatLen=thatKeys.length;for(var i=0;i<thatLen;i+=1){curElement=thatKeys[i];if(!self.has(curElement)){thisKeys.push(curElement)}}return thisKeys};SetInterface.prototype.has=function has(element){};SetInterface.prototype.entries=function entries(){};SetInterface.prototype.remove=function remove(element){};SetInterface.prototype.intersect=function intersect(thatSet){var largerSet=void 0,smallerSet=void 0;var self=this;var result=[];if(self.cardinality()>thatSet.cardinality()){largerSet=self;smallerSet=thatSet.entries()}else{largerSet=thatSet;smallerSet=self.entries()}var smallLen=smallerSet.length;var curElement=void 0;for(var i=0;i<smallLen;i+=1){curElement=smallerSet[i];if(largerSet.has(curElement)){result.push(curElement)}}return result};SetInterface.prototype.cardinality=function cardinality(){};return SetInterface}();exports["default"]=SetInterface},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _BSTNode=__webpack_require__(12);var _BSTNode2=_interopRequireDefault(_BSTNode);var _BSTPrototype=__webpack_require__(13);var _Util=__webpack_require__(2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var BST=function(){function BST(comparator){_classCallCheck(this,BST);this.root=new _BSTNode2["default"];this.comparator=comparator||_Util.defaultComparator;this.inserts=0}BST.prototype.put=function put(){var key=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var value=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var self=this;var inserted=_BSTPrototype.BSTInsert.call(self,key,value,_BSTNode2["default"]);if(inserted){self.inserts+=1}return self};BST.prototype.remove=function remove(key){var self=this;var removed=_BSTPrototype.BSTRemove.call(self,key);if(removed){self.inserts-=1;return true}return false};BST.prototype.getVal=function getVal(key){var self=this;var node=_BSTPrototype.BSTSearch.call(self,self.root,key);return node?node.value:undefined};BST.prototype.contains=function contains(key){return this.getVal(key)!==undefined};BST.prototype.inorder=function inorder(){var result=[];(0,_BSTPrototype.BSTInorder)(this.root,result);return result};BST.prototype.min=function min(){return(0,_BSTPrototype.minOrMax)("min",this.root)};BST.prototype.max=function max(){return(0,_BSTPrototype.minOrMax)("max",this.root)};BST.prototype.keysLess=function keysLess(value){var self=this;var result=[];(0,_BSTPrototype.less)(self.root,value,self.comparator,result);return result};BST.prototype.keysGreater=function keysGreater(value){var self=this;var result=[];(0,_BSTPrototype.greater)(self.root,value,self.comparator,result);return result};BST.prototype.clear=function clear(){this.root=null;this.inserts=0};BST.prototype.size=function size(){return this.inserts};BST.prototype.keys=function keys(){var result=[];(0,_BSTPrototype.getKeysOrValues)(this.root,"key",result);return result};BST.prototype.values=function values(){var result=[];(0,_BSTPrototype.getKeysOrValues)(this.root,"value",result);return result};BST.prototype.keyRange=function keyRange(lower,upper){var self=this;if(lower===undefined||upper===undefined){throw new TypeError("Both a lower and upper bound are required")}if(self.comparator(lower,upper)!==-1){throw new RangeError("Lower bound must be strictly less than upper bound")}var res=[];(0,_BSTPrototype.keysBetween)(self.root,lower,upper,self.comparator,res);return res};return BST}();exports["default"]=BST},function(module,exports){"use strict";exports.__esModule=true;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var BSTNode=function(){function BSTNode(key,value){_classCallCheck(this,BSTNode);this.parent=null;this.left=null;this.right=null;this.key=key;this.value=value}BSTNode.prototype.isNil=function isNil(){return this.key===undefined};BSTNode.prototype.isLeftChild=function isLeftChild(){return this.parent.left===this};BSTNode.prototype.hasLeftChild=function hasLeftChild(){return this.left.key!==undefined};BSTNode.prototype.hasRightChild=function hasRightChild(){return this.right.key!==undefined};BSTNode.prototype.isRightChild=function isRightChild(){return this.parent.right===this};return BSTNode}();exports["default"]=BSTNode},function(module,exports){"use strict";exports.__esModule=true;exports.BSTInsert=BSTInsert;exports.BSTSearch=BSTSearch;exports.BSTRemove=BSTRemove;exports.BSTInorder=BSTInorder;exports.getKeysOrValues=getKeysOrValues;exports.less=less;exports.greater=greater;exports.minOrMax=minOrMax;exports.keysBetween=keysBetween;function adjustParentAndChildrenOfNewNode(newNode,oldRoot,comparator,NodeType){newNode.parent=oldRoot;if(oldRoot.isNil()){this.root=newNode}else if(comparator(newNode.key,oldRoot.key)===-1){oldRoot.left=newNode}else{oldRoot.right=newNode}newNode.left=new NodeType;newNode.right=new NodeType}function BSTInsert(key,value,NodeType){var comparator=this.comparator;var root=this.root;var newNode=new NodeType(key,value);var oldRoot=new NodeType;while(!root.isNil()){var comparatorResult=comparator(newNode.key,root.key);oldRoot=root;if(comparatorResult===-1){root=root.left}else if(comparatorResult===1){root=root.right}else{root.value=value;return}}adjustParentAndChildrenOfNewNode.call(this,newNode,oldRoot,comparator,NodeType);return newNode}function BSTSearch(root,key){var currentRoot=root;var comparator=this.comparator;while(!currentRoot.isNil()){var comparatorResult=comparator(currentRoot.key,key);if(comparatorResult===0){return currentRoot}else if(comparatorResult===-1){currentRoot=currentRoot.right}else{currentRoot=currentRoot.left}}}function successor(node){var nodeSuccessor=node.right;while(nodeSuccessor.hasLeftChild()){nodeSuccessor=nodeSuccessor.left}return nodeSuccessor}function swapPropsWithSucccessor(nodeSuccessor,node){if(nodeSuccessor!==node){node.key=nodeSuccessor.key;node.value=nodeSuccessor.value}}function BSTRemove(key){var node=BSTSearch.call(this,this.root,key);if(!node){return false}var nodeSuccessor=void 0;var successorChild=void 0;if(!node.hasLeftChild()||!node.hasRightChild()){nodeSuccessor=node}else{nodeSuccessor=successor(node)}if(nodeSuccessor.hasLeftChild()){successorChild=nodeSuccessor.left}else{successorChild=nodeSuccessor.right}successorChild.parent=nodeSuccessor.parent;if(nodeSuccessor.parent.isNil()){this.root=successorChild}else if(nodeSuccessor.isLeftChild()){nodeSuccessor.parent.left=successorChild}else{nodeSuccessor.parent.right=successorChild}swapPropsWithSucccessor(nodeSuccessor,node);return{successorChild:successorChild,nodeSuccessor:nodeSuccessor}}function BSTInorder(root,array){if(root&&!root.isNil()){BSTInorder(root.left,array);array.push(root);BSTInorder(root.right,array)}}function getKeysOrValues(root,prop,array){if(root&&!root.isNil()){getKeysOrValues(root.left,prop,array);array.push(root[prop]);getKeysOrValues(root.right,prop,array)}}function less(root,value,comparator,array){if(!root||root.isNil()){return}var rootKey=root.key;var comparatorResult=comparator(rootKey,value);if(comparatorResult===-1){array.push(rootKey);less(root.left,value,comparator,array);return less(root.right,value,comparator,array)}return less(root.left,value,comparator,array)}function greater(root,value,comparator,array){if(!root||root.isNil()){return}var rootKey=root.key;var comparatorResult=comparator(rootKey,value);if(comparatorResult===1){array.push(rootKey);greater(root.left,value,comparator,array);return greater(root.right,value,comparator,array)}return greater(root.right,value,comparator,array)}function minOrMax(query,root){var currentRoot=root;var direction=query==="min"?"left":"right";if(currentRoot.isNil()){return}while(currentRoot[direction].key!==undefined){currentRoot=currentRoot[direction]}return currentRoot.key}function keysBetween(root,lower,upper,comparator,array){if(!root||root.isNil()){return}var rootKey=root.key;var lowerRootComp=comparator(lower,rootKey);if(lowerRootComp>=0){if(lowerRootComp===0){array.push(rootKey)}return keysBetween(root.right,lower,upper,comparator,array)}if(comparator(rootKey,upper)<=0){array.push(rootKey)}keysBetween(root.left,lower,upper,comparator,array);return keysBetween(root.right,lower,upper,comparator,array)}},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _Queue=__webpack_require__(4);var _Queue2=_interopRequireDefault(_Queue);var _Stack=__webpack_require__(3);var _Stack2=_interopRequireDefault(_Stack);var _RedBlackTree=__webpack_require__(15);var _RedBlackTree2=_interopRequireDefault(_RedBlackTree);var _HashSet=__webpack_require__(9);var _HashSet2=_interopRequireDefault(_HashSet);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function FirstSearch(graph,startingVertex,structure,BFS){var add=BFS?_Queue2["default"].prototype.enqueue.bind(structure):_Stack2["default"].prototype.push.bind(structure);var remove=BFS?_Queue2["default"].prototype.dequeue.bind(structure):_Stack2["default"].prototype.pop.bind(structure);var res=[];var visited=new _HashSet2["default"](graph.size());add(startingVertex);while(structure.size()!==0){var currentVertex=remove();if(!visited.has(currentVertex)){visited.add(currentVertex);res.push(currentVertex);var currentVertexNeighbors=graph.getVal(currentVertex).length;for(var i=0;i<currentVertexNeighbors;i+=1){var curNeighbor=graph.getVal(currentVertex)[i].vertex;if(!visited.has(curNeighbor)){add(curNeighbor)}}}}return res}var Graph=function(){function Graph(){_classCallCheck(this,Graph);this.graph=new _RedBlackTree2["default"]}Graph.prototype.addVertex=function addVertex(vertex){var graph=this.graph;if(!graph.contains(vertex)){graph.put(vertex,[])}};Graph.prototype.addEdge=function addEdge(vertex1,vertex2,weight){var graph=this.graph;var v1neighbors=graph.getVal(vertex1);var v2neighbors=graph.getVal(vertex2);if(v1neighbors&&v2neighbors){if(v1neighbors.indexOf(vertex2)===-1&&v2neighbors.indexOf(vertex2)===-1){v1neighbors.push({vertex:vertex2,weight:weight});v2neighbors.push({vertex:vertex1,weight:weight})}}};Graph.prototype.BFS=function BFS(startingVertex){var graph=this.graph;if(!graph.contains(startingVertex)){return[]}return FirstSearch(graph,startingVertex,new _Queue2["default"],true)};Graph.prototype.DFS=function DFS(startingVertex){var graph=this.graph;if(!graph.contains(startingVertex)){return[]}return FirstSearch(graph,startingVertex,new _Stack2["default"],false)};Graph.prototype.isConnected=function isConnected(){var graph=this.graph;var verticies=graph.keys();var firstKey=verticies[0];return this.BFS(firstKey).length===verticies.length};return Graph}();exports["default"]=Graph},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _BSTNode2=__webpack_require__(12);var _BSTNode3=_interopRequireDefault(_BSTNode2);var _BSTPrototype=__webpack_require__(13);var _BST2=__webpack_require__(11);var _BST3=_interopRequireDefault(_BST2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defaults(obj,defaults){var keys=Object.getOwnPropertyNames(defaults);for(var i=0;i<keys.length;i++){var key=keys[i];var value=Object.getOwnPropertyDescriptor(defaults,key);if(value&&value.configurable&&obj[key]===undefined){Object.defineProperty(obj,key,value)}}return obj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?_defaults(subClass,superClass):_defaults(subClass,superClass)}var BLACK="black";var RED="red";var RBNode=function(_BSTNode){_inherits(RBNode,_BSTNode);function RBNode(key,value){_classCallCheck(this,RBNode);var _this=_possibleConstructorReturn(this,_BSTNode.call(this,key,value));_this.color=BLACK;return _this}RBNode.prototype.isRed=function isRed(){return this.color===RED};RBNode.prototype.isBlack=function isBlack(){return this.color===BLACK};return RBNode}(_BSTNode3["default"]);function leftRotate(node){var oldRight=node.right;var nodeParent=node.parent;node.right=oldRight.left;oldRight.left.parent=node;oldRight.parent=nodeParent;if(nodeParent.isNil()){this.root=oldRight}else if(node.isLeftChild()){nodeParent.left=oldRight}else{nodeParent.right=oldRight}oldRight.left=node;node.parent=oldRight}function rightRotate(node){var oldLeft=node.left;var nodeParent=node.parent;node.left=oldLeft.right;oldLeft.right.parent=node;oldLeft.parent=nodeParent;if(nodeParent.isNil()){this.root=oldLeft}else if(node.isLeftChild()){nodeParent.left=oldLeft}else{nodeParent.right=oldLeft}oldLeft.right=node;node.parent=oldLeft}function insertFixRecolor(uncle,currentNode){currentNode.parent.color=BLACK;uncle.color=BLACK;currentNode.parent.parent.color=RED}function insertFixRotate1(node,context){var currentNode=node;if(currentNode.isRightChild()){currentNode=currentNode.parent;leftRotate.call(context,currentNode)}currentNode.parent.color=BLACK;currentNode.parent.parent.color=RED;rightRotate.call(context,currentNode.parent.parent)}function insertFixRotate2(node,context){var currentNode=node;if(currentNode.isLeftChild()){currentNode=currentNode.parent;rightRotate.call(context,currentNode)}currentNode.parent.color=BLACK;currentNode.parent.parent.color=RED;leftRotate.call(context,currentNode.parent.parent)}function deleteRedSiblingCaseRecolor(currentNode,sibling){sibling.color=BLACK;currentNode.parent.color=RED}function insertFix(nodeToFix){var currentNode=nodeToFix;var context=this;var uncle=void 0;while(currentNode.parent.isRed()){if(currentNode.parent.isLeftChild()){uncle=currentNode.parent.parent.right;if(uncle.isRed()){insertFixRecolor(uncle,currentNode);currentNode=currentNode.parent.parent}else{insertFixRotate1(currentNode,context)}}else{uncle=currentNode.parent.parent.left;if(uncle.isRed()){insertFixRecolor(uncle,currentNode);currentNode=currentNode.parent.parent}else{insertFixRotate2(currentNode,context)}}}context.root.color=BLACK}function deletefixUp(nodeToFix){var currentNode=nodeToFix;var context=this;while(!currentNode.parent.isNil()&¤tNode.isBlack()){var sibling=void 0;if(currentNode.isLeftChild()){sibling=currentNode.parent.right;if(sibling.isRed()){deleteRedSiblingCaseRecolor(currentNode,sibling);leftRotate.call(context,currentNode.parent);sibling=currentNode.parent.right}if(sibling.left.isBlack()&&sibling.right.isBlack()){sibling.color=RED;currentNode=currentNode.parent}else{if(sibling.right.isBlack()){sibling.left.color=BLACK;sibling.color=RED;rightRotate.call(context,sibling);sibling=currentNode.parent.right}sibling.color=currentNode.parent.color;currentNode.parent.color=BLACK;sibling.right.color=BLACK;leftRotate.call(context,currentNode.parent);currentNode=context.root}}else{sibling=currentNode.parent.left;if(sibling.isRed()){deleteRedSiblingCaseRecolor(currentNode,sibling);rightRotate.call(context,currentNode.parent);sibling=currentNode.parent.left}if(sibling.right.isBlack()&&sibling.left.isBlack()){sibling.color=RED;currentNode=currentNode.parent}else{if(sibling.left.isBlack()){sibling.right.color=BLACK;sibling.color=RED;leftRotate.call(context,sibling);sibling=currentNode.parent.left}sibling.color=currentNode.parent.color;currentNode.parent.color=BLACK;sibling.left.color=BLACK;rightRotate.call(context,currentNode.parent);currentNode=context.root}}}currentNode.color=BLACK}var RBTree=function(_BST){_inherits(RBTree,_BST);function RBTree(comparator){_classCallCheck(this,RBTree);var _this2=_possibleConstructorReturn(this,_BST.call(this,comparator));_this2.root=new RBNode;return _this2}RBTree.prototype.put=function put(key,value){var self=this;var insertedNode=_BSTPrototype.BSTInsert.call(self,key,value,RBNode);if(insertedNode){insertedNode.color=RED;insertFix.call(self,insertedNode);self.inserts+=1}return self};RBTree.prototype.remove=function remove(key){var self=this;var didRemove=_BSTPrototype.BSTRemove.call(self,key);if(didRemove){var successorChild=didRemove.successorChild,nodeSuccessor=didRemove.nodeSuccessor;if(nodeSuccessor.isBlack()){deletefixUp.call(self,successorChild)}self.inserts-=1;return true}return false};return RBTree}(_BST3["default"]);exports["default"]=RBTree},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _Util=__webpack_require__(2);function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function toLowerCaseString(data){return(0,_Util.toString)(data).toLowerCase()}function getNode(root,pattern){if(pattern.length===0){return false}var currentNode=root.children;var currentChar=void 0;for(var i=0;i<pattern.length-1;i+=1){currentChar=pattern.charAt(i);if(!currentNode[currentChar]){return false}currentNode=currentNode[currentChar].children}return currentNode}function recurseTree(trieNode,array){if(!trieNode){return}var keys=Object.keys(trieNode);for(var i=0;i<keys.length;i+=1){var currentNode=trieNode[keys[i]];if(currentNode.endOfWord){array.push(currentNode.word)}recurseTree(currentNode.children,array)}}var TrieNode=function(){function TrieNode(){_classCallCheck(this,TrieNode);this.children={};this.endOfWord=false;this.word=null}TrieNode.prototype.hasChildren=function hasChildren(){var children=this.children;for(var prop in children){if(Object.prototype.hasOwnProperty.call(children,prop)){return true}}return false};return TrieNode}();var Trie=function(){function Trie(){_classCallCheck(this,Trie);this.root=new TrieNode}Trie.prototype.addWord=function addWord(){var data=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";var currentNode=this.root.children;var word=toLowerCaseString(data);var currentChar=void 0;for(var i=0;i<word.length;i+=1){currentChar=word.charAt(i);if(!currentNode[currentChar]){currentNode[currentChar]=new TrieNode}if(i===word.length-1){currentNode[currentChar].endOfWord=true;currentNode[currentChar].word=word}currentNode=currentNode[currentChar].children}};Trie.prototype.containsWord=function containsWord(){var data=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";var word=toLowerCaseString(data);var foundNode=getNode(this.root,word);if(foundNode){var lastChar=word.charAt(word.length-1);if(foundNode[lastChar]&&foundNode[lastChar].word===word){return true}}return false};Trie.prototype.containsPrefix=function containsPrefix(){var prefix=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";var root=this.root;var str=toLowerCaseString(prefix);var foundNode=getNode(root,str);if(foundNode){var lastChar=str.charAt(str.length-1);if(foundNode[lastChar]){return foundNode[lastChar].hasChildren()}}return false};Trie.prototype.prefixAll=function prefixAll(){var prefix=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";if(!this.containsPrefix(prefix)){return[]}var word=toLowerCaseString(prefix);var prefixTail=getNode(this.root,word);var lastChar=word.charAt(word.length-1);var prefixes=[];recurseTree(prefixTail[lastChar].children,prefixes);return prefixes};return Trie}();exports["default"]=Trie},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _Util=__webpack_require__(2);function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var ArrayUtils=function(){function ArrayUtils(){_classCallCheck(this,ArrayUtils)}ArrayUtils.remove=function remove(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var index=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return index>=0?array.splice(index,1):[]};ArrayUtils.removeElement=function removeElement(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var predicate=arguments[1];var indexToRemove=ArrayUtils.findIndex(array,predicate);return ArrayUtils.remove(array,indexToRemove)};ArrayUtils.rotate=function rotate(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var times=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var len=array.length;if(times>0){var upperBound=len-times;return array.slice(upperBound).concat(array.slice(0,upperBound))}var timesToPositiveInt=Math.abs(times);return array.slice(timesToPositiveInt).concat(array.slice(0,timesToPositiveInt))};ArrayUtils.popMany=function popMany(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var times=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var upperBound=array.length-times;return upperBound>0?array.slice(0,upperBound):[]};ArrayUtils.pushMany=function pushMany(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}return array.concat(args)};ArrayUtils.shiftMany=function shiftMany(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var times=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return times>0?array.slice(times):array};ArrayUtils.unshiftMany=function unshiftMany(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2]}return args.concat(array)};ArrayUtils.getRand=function getRand(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var randomIndex=(0,_Util.generateRandomInt)(array.length);return array[randomIndex]};ArrayUtils.removeRand=function removeRand(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var randomIndex=(0,_Util.generateRandomInt)(array.length);return ArrayUtils.remove(array,randomIndex)};ArrayUtils.shuffle=function shuffle(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var arrayLength=array.length;for(var i=arrayLength-1;i>0;i-=1){var randomIndex=(0,_Util.generateRandomInt)(i+1);(0,_Util.swap)(array,randomIndex,i)}};ArrayUtils.flatten=function flatten(array){var res=[];(0,_Util.flat)(array,res);return res};ArrayUtils.chunk=function chunk(){var array=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var bits=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var newArr=[];if(bits<=0){return newArr}for(var i=0,len=array.length;i<len;i+=bits){var newChunk=array.slice(i,i+bits);newArr.push(newChunk)}return newArr};ArrayUtils.find=function find(array,callback){var len=array.length;var index=0;while(index<len){var data=array[index];if(callback(data,index)){return data}index+=1}};ArrayUtils.findIndex=function findIndex(array,callback){var len=array.length;var index=0;while(index<len){if(callback(array[index],index)){return index}index+=1}return-1};ArrayUtils.filterNot=function filterNot(array,callback){var len=array.length;var res=[];var index=0;while(index<len){var data=array[index];if(!callback(data,index)){res.push(data)}index+=1}return res};ArrayUtils.mapIf=function mapIf(array,test,mapper){var len=array.length;var index=0;var res=[];while(index<len){var data=array[index];if(test(data,index)){var mappedElement=mapper(data,index);res.push(mappedElement)}index+=1}return res};return ArrayUtils}();exports["default"]=ArrayUtils},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _SetInterface2=__webpack_require__(10);var _SetInterface3=_interopRequireDefault(_SetInterface2);var _RedBlackTree=__webpack_require__(15);var _RedBlackTree2=_interopRequireDefault(_RedBlackTree);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defaults(obj,defaults){var keys=Object.getOwnPropertyNames(defaults);for(var i=0;i<keys.length;i++){var key=keys[i];var value=Object.getOwnPropertyDescriptor(defaults,key);if(value&&value.configurable&&obj[key]===undefined){Object.defineProperty(obj,key,value)}}return obj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?_defaults(subClass,superClass):_defaults(subClass,superClass)}var Set=function(_SetInterface){_inherits(Set,_SetInterface);function Set(comparator){_classCallCheck(this,Set);var _this=_possibleConstructorReturn(this,_SetInterface.call(this));_this.set=new _RedBlackTree2["default"](comparator);return _this}Set.prototype.add=function add(element){this.set.put(element,1);return this};Set.prototype.has=function has(element){return this.set.contains(element)};Set.prototype.remove=function remove(element){return this.set.remove(element)};Set.prototype.entries=function entries(){return this.set.keys()};Set.prototype.cardinality=function cardinality(){return this.set.size()};Set.prototype.min=function min(){return this.map.min()};Set.prototype.max=function max(){return this.map.max()};Set.prototype.union=function union(thatSet){return _SetInterface.prototype.union.call(this,thatSet)};Set.prototype.intersect=function intersect(thatSet){return _SetInterface.prototype.intersect.call(this,thatSet)};Set.prototype.diff=function diff(thatSet){return _SetInterface.prototype.diff.call(this,thatSet)};return Set}(_SetInterface3["default"]);exports["default"]=Set},function(module,exports,__webpack_require__){"use strict";exports.__esModule=true;var _RedBlackTree=__webpack_require__(15);var _RedBlackTree2=_interopRequireDefault(_RedBlackTree);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defaults(obj,defaults){var keys=Object.getOwnPropertyNames(defaults);for(var i=0;i<keys.length;i++){var key=keys[i];var value=Object.getOwnPropertyDescriptor(defaults,key);if(value&&value.configurable&&obj[key]===undefined){Object.defineProperty(obj,key,value)}}return obj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?_defaults(subClass,superClass):_defaults(subClass,superClass)}var MultiMap=function(_RBTree){_inherits(MultiMap,_RBTree);function MultiMap(comparator){_classCallCheck(this,MultiMap);return _possibleConstructorReturn(this,_RBTree.call(this,comparator))}MultiMap.prototype.put=function put(key,value){var foundValues=_RBTree.prototype.getVal.call(this,key);if(foundValues){if(foundValues.indexOf(value)===-1){foundValues.push(value)}}else{_RBTree.prototype.put.call(this,key,[value])}return this};MultiMap.prototype.removeVal=function removeVal(key,value){var foundValues=_RBTree.prototype.getVal.call(this,key);var removedValue=[];if(foundValues&&foundValues.length>0){var indexOfValue=foundValues.indexOf(value);if(indexOfValue!==-1){removedValue=foundValues.splice(indexOfValue,1)}}return removedValue};MultiMap.prototype.containsEntry=function containsEntry(key,value){var foundValues=_RBTree.prototype.getVal.call(this,key);if(foundValues&&foundValues.length>0){return foundValues.indexOf(value)!==-1}return false};MultiMap.prototype.replaceVal=function replaceVal(key,oldValue,newValue){var foundValues=_RBTree.prototype.getVal.call(this,key);if(foundValues&&foundValues.length>0){var index=foundValues.indexOf(oldValue);if(index!==-1){return foundValues.splice(index,1,newValue)}}return[]};return MultiMap}(_RedBlackTree2["default"]);exports["default"]=MultiMap}])});