sangja
Version:
JavaScript data structures library
1 lines • 81.9 kB
Source Map (JSON)
{"version":3,"sources":["webpack://sangja/webpack/universalModuleDefinition","webpack://sangja/webpack/bootstrap","webpack://sangja/./src/utils.js","webpack://sangja/./src/queue.js","webpack://sangja/./src/linked-list.js","webpack://sangja/./src/index.js","webpack://sangja/./src/optional.js","webpack://sangja/./src/stack.js","webpack://sangja/./src/heap.js","webpack://sangja/./src/binary-search-tree.js"],"names":["root","factory","exports","module","define","amd","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","isIterable","obj","iterator","defaultKey","x","defaultCompare","y","mergeOptions","given","original","merged","keys","forEach","Utils","LinkedList","Queue","[object Object]","iterable","TypeError","_linkedList","addLast","v","size","popFirst","getFirst","isEmpty","f","queue","map","flatMap","filter","reversed","some","every","includes","front","end","index","now","next","prev","undefined","RangeError","item","_getNode","addAllLast","values","length","add","popLast","pop","result","remove","push","removeMatch","ret","list","addFirst","Optional","Stack","Heap","BinarySearchTree","err","Boolean","_stack","stack","arr","pushAll","a","b","compare","reverse","_heap","_options","_key","_compare","Math","floor","tmp","left","right","heapForIter","slice","options","heap","addAll","that","_root","children","parent","direction","comp","rightmostParent","rightmost","removeVal","_getMatch","node","nodes","_forEach","tree","constructor","_some","_every","inorder","_inorderIterator","_inorder","_preorderIterator","_preorder","_postorderIterator","_postorder","enqueue","dequeue","_breadthFirst"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,YAAAH,GACA,iBAAAC,QACAA,QAAA,OAAAD,IAEAD,EAAA,OAAAC,IARA,CASCK,KAAA,WACD,mBCTA,IAAAC,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,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AAV,GACA,OAAAA,UACAA,EAAA/G,YACAyH,EAAAV,EAAAjB,YACA2B,EAAAV,EAAAhB,QAJA,CAMOpH,KAAA2H,QAGP,SAAAoB,EAAAX,GACA,OAAAA,IACAtE,EAAAsE,EAAA/G,OACA0H,EAAAX,EAAAjB,MACA4B,EAAAX,EAAAhB,QAGA2B,CAAA/I,KAAA2H,OASAvE,UAAAU,GACA,IAAAA,EACA,gBAAAkF,EAAAZ,GACA,OAAAA,UACAY,EAAAZ,EAAAjB,YACA6B,EAAAZ,EAAAhB,aACAgB,EAAA/G,OAJA,CAMOrB,KAAA2H,QAGP,SAAAsB,EAAAb,GACA,OAAAA,IACAa,EAAAb,EAAAjB,MACA8B,EAAAb,EAAAhB,OACAtD,EAAAsE,EAAA/G,QAGA4H,CAAAjJ,KAAA2H,OASAvE,aAAAU,GACA,IAAAA,EACA,iBAAApE,GACA,MAAAqE,EAAA,IAAAZ,EAEA,IADAY,EAAAmF,QAAAxJ,GACAqE,EAAAL,OAAA,IACA,MAAAgB,EAAAX,EAAAoF,UACAzE,gBACAA,EAAArD,MACA0C,EAAAmF,QAAAxE,EAAAyC,MACApD,EAAAmF,QAAAxE,EAAA0C,SARA,CAWOpH,KAAA2H,QAGP,SAAAjI,GACA,MAAAqE,EAAA,IAAAZ,EAEA,IADAY,EAAAmF,QAAAxJ,GACAqE,EAAAL,OAAA,IACA,MAAAgB,EAAAX,EAAAoF,UACAzE,UACAZ,EAAAY,EAAArD,OACA0C,EAAAmF,QAAAxE,EAAAyC,MACApD,EAAAmF,QAAAxE,EAAA0C,SAIAgC,CAAApJ,KAAA2H","file":"sangja.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"sangja\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"sangja\"] = factory();\n\telse\n\t\troot[\"sangja\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n","/**\n * Check if given object is iterable\n * @function\n * @memberof sangja\n * @param {*} obj - An object to check if iterable\n * @return {boolean} True if obj is iterable else false\n */\nfunction isIterable(obj) {\n // checks for null and undefined\n if (obj == null) {\n return false;\n }\n return typeof obj[Symbol.iterator] === 'function';\n}\n\n/**\n * Default key function.<br>\n * Data structures that require compare will use this function as a default key function.<br>\n * Returns the input argument as it is.\n * @function\n * @memberof sangja\n */\nconst defaultKey = x => x;\n\n/**\n * Default compare function.<br>\n * Data structures that require compare will use this function as a default compare function.<br>\n * Compare 2 given operands and return the result. This function can compare number, string.\n * @function\n * @memberof sangja\n */\nconst defaultCompare = (x, y) => {\n if (x < y) {\n return -1;\n }\n if (x > y) {\n return 1;\n }\n return 0;\n};\n\nfunction mergeOptions(given = {}, original = {}) {\n if (!given) {\n return original;\n }\n\n const merged = {};\n Object.keys(original).forEach((key) => {\n merged[key] = given[key] || original[key];\n });\n return merged;\n}\n\nmodule.exports = {\n isIterable,\n defaultKey,\n defaultCompare,\n mergeOptions,\n};\n","const Utils = require('./utils');\nconst LinkedList = require('./linked-list');\n\n/**\n * @class\n * @memberof sangja\n */\nclass Queue {\n /**\n * Creates a new Queue.\n * Iterable parameter is optional.\n * @constructor\n * @param {iterable} [iterable] - Iterator for initialize the queue.\n * @throws {TypeError} When given parameter is not queue.\n */\n constructor(iterable = []) {\n if (!Utils.isIterable(iterable)) {\n throw TypeError();\n }\n this._linkedList = new LinkedList(iterable);\n }\n\n /**\n * Add value at the rear of the queue.\n * @param {*} value - The value to enqueue to the queue.\n */\n enqueue(value) {\n this._linkedList.addLast(value);\n }\n\n /**\n * Add values in the given iterator at the rear of the queue.\n * @param {iterable} iterable - The iterable values to enqueue\n */\n enqueueAll(iterable) {\n [...iterable].forEach(v => this._linkedList.addLast(v));\n }\n\n /**\n * Removes the front of the queue and returns the value at the front of the queue.\n * @returns {*} The value at the front of the queue. If empty, return undefined.\n */\n dequeue() {\n if (this._linkedList.size() === 0) {\n return undefined;\n }\n\n return this._linkedList.popFirst();\n }\n\n /**\n * Returns the value at the front of the queue without changing the state of the queue.\n * @returns {*} The value at the front of the queue. If empty, return undefined.\n */\n peek() {\n if (this._linkedList.size() === 0) {\n return undefined;\n }\n\n return this._linkedList.getFirst();\n }\n\n /**\n * Returns the number of elements in the queue.\n * @returns {number} The number of elements in the queue.\n */\n size() {\n return this._linkedList.size();\n }\n\n /**\n * Returns whether the queue is empty.\n * @returns {boolean} True if the queue is empty.\n */\n isEmpty() {\n return this._linkedList.isEmpty();\n }\n\n /**\n * Removes all values in the queue.\n */\n clear() {\n this._linkedList = new LinkedList();\n }\n\n /**\n * For each values in the queue, execute the given procedure f.\n * @param {function} f - Procedure to execute\n */\n forEach(f) {\n this._linkedList.forEach(f);\n }\n\n /**\n * Returns a new Queue whose values are mapped with given function f.\n * @param {function} f - Function to map values\n * @return {Stack} Queue([mapped values])\n */\n map(f) {\n const queue = new Queue();\n queue._linkedList = this._linkedList.map(f);\n return queue;\n }\n\n /**\n * Returns a new Queue whose values are mapped with given function f and flattened.\n * @param {function} f - Function (this.value) => iterable\n * @return {Stack} Queue([mapped and flattened values])\n */\n flatMap(f) {\n const queue = new Queue();\n queue._linkedList = this._linkedList.flatMap(f);\n return queue;\n }\n\n /**\n * Returns a new Queue whose values are filtered with given predicate f.\n * @param {function} f - Predicate (this.value) => boolean\n * @return {Stack} Queue([filtered values])\n */\n filter(f) {\n const queue = new Queue();\n queue._linkedList = this._linkedList.filter(f);\n return queue;\n }\n\n /**\n * Returns a new Queue whose values are reversed in order.\n * @return {Stack} Queue([reversed values])\n */\n reversed() {\n const queue = new Queue();\n queue._linkedList = this._linkedList.reversed();\n return queue;\n }\n\n /**\n * If any of containing values satisfies given f, return true.\n * If none of values satisfy f or not contain any value, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n some(f) {\n return this._linkedList.some(f);\n }\n\n /**\n * If all of containing values satisfies given f or not contain any value, return true.\n * If any of value doesn't satisfy f, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n every(f) {\n return this._linkedList.every(f);\n }\n\n /**\n * If contains given value v, return true.\n * @param {*} v\n * @returns {boolean}\n */\n includes(v) {\n return this._linkedList.includes(v);\n }\n\n * [Symbol.iterator]() {\n yield* this._linkedList;\n }\n}\n\nmodule.exports = Queue;\n","const Utils = require('./utils');\n\n/**\n * @class\n * @memberof sangja\n */\nclass LinkedList {\n /**\n * Creates a new LinkedList.\n * Iterable parameter is optional.\n * @constructor\n * @param {iterable} [iterable] - Iterator for initialize the list.\n * @throws {TypeError} When given parameter is not iterable.\n */\n constructor(iterable = []) {\n this._linkedList = {\n size: 0,\n front: null,\n end: null,\n };\n if (!Utils.isIterable(iterable)) {\n throw TypeError();\n }\n [...iterable].forEach(v => this.addLast(v));\n }\n\n /**\n * Return the node at the given index of the linked list.\n * @param {number} index - The index to get node.\n * @private\n * @return {node} The node at the given index.\n * When the given index < 0 or index >= size of the linked list, return undefined.\n */\n _getNode(index) {\n if (typeof index !== 'number' || index < 0 || index >= this._linkedList.size) {\n return undefined;\n }\n if (index < this._linkedList.size / 2) {\n let now = this._linkedList.front;\n for (let i = 0; i < index; i += 1) {\n now = now.next;\n }\n return now;\n }\n let now = this._linkedList.end;\n for (let i = this._linkedList.size - 1; i > index; i -= 1) {\n now = now.prev;\n }\n return now;\n }\n\n /**\n * Add value at the given index of the linked list.\n * @param {number} [index] - The index to add the value.\n * @param {*} value - The value to add.\n * @throws {RangeError} When the given index < 0 or index > size of the linked list.\n */\n add(index, value) {\n // Index not given. index is the value to add.\n if (value === undefined) {\n this.addLast(index);\n return;\n }\n if (typeof index !== 'number' || index < 0 || index > this._linkedList.size) {\n throw RangeError();\n }\n\n if (index === 0) {\n const item = {\n prev: null,\n next: this._linkedList.front,\n value,\n };\n if (this._linkedList.front) {\n this._linkedList.front.prev = item;\n } else {\n // No elements until now.\n this._linkedList.end = item;\n }\n this._linkedList.front = item;\n } else if (index === this._linkedList.size) {\n const item = {\n prev: this._linkedList.end,\n next: null,\n value,\n };\n if (this._linkedList.end) {\n this._linkedList.end.next = item;\n }\n this._linkedList.end = item;\n } else {\n const original = this._getNode(index);\n\n const item = {\n prev: original.prev,\n next: original,\n value,\n };\n item.prev.next = item;\n item.next.prev = item;\n }\n this._linkedList.size += 1;\n }\n\n /**\n * Add values in given iterator at the given index of the linked list.\n * @param {number} [index] - The index to add the value.\n * @param {iterable} iterable - The iterable object that contain values to add.\n * @throws {RangeError} When the given index < 0 or index > size of the linked list.\n */\n addAll(index, iterable) {\n // Index not given. index is iterable object.\n if (iterable === undefined) {\n this.addAllLast(index);\n return;\n }\n const values = [...iterable];\n for (let i = values.length - 1; i >= 0; i -= 1) {\n this.add(index, values[i]);\n }\n }\n\n /**\n * Add value at the front of the linked list.\n * @param {*} value - The value to add.\n */\n addFirst(value) {\n this.add(0, value);\n }\n\n /**\n * Add values in given iterator at the front of the linked list.\n * @param {iterable} iterable - The iterable object that contain values to add.\n */\n addAllFirst(iterable) {\n const values = [...iterable];\n for (let i = values.length - 1; i >= 0; i -= 1) {\n this.add(0, values[i]);\n }\n }\n\n /**\n * Add value at the end of the linked list.\n * @param {*} value - The value to add.\n */\n addLast(value) {\n this.add(this.size(), value);\n }\n\n /**\n * Add values in given iterator at the end of the linked list.\n * @param {iterable} iterable - The iterable object that contain values to add.\n */\n addAllLast(iterable) {\n const values = [...iterable];\n for (let i = 0; i < values.length; i += 1) {\n this.addLast(values[i]);\n }\n }\n\n /**\n * Removes the given index of the linked list and\n * returns the value at the given index of the linked list.\n * @param {number} [index] - The index to remove the value.\n * @return {*} The value at the given index of the linked list. If not found, return undefined.\n */\n pop(index) {\n if (index === undefined) {\n return this.popLast();\n }\n if (typeof index !== 'number' || index < 0 || index >= this._linkedList.size) {\n return undefined;\n }\n const now = this._getNode(index);\n\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n return now.value;\n }\n\n /**\n * Removes the first of the linked list and\n * returns the value at the first of the linked list.\n * @return {*} The value at the front of the linked list. If empty, return undefined.\n */\n popFirst() {\n return this.pop(0);\n }\n\n /**\n * Removes the end of the linked list and\n * returns the value at the end of the linked list.\n * @return {*} The value at the end of the linked list. If empty, return undefined.\n */\n popLast() {\n return this.pop(this.size() - 1);\n }\n\n /**\n * Same with pop(i) except that index is required.\n * @param {number} index - The index to remove the value.\n * @return {(*|undefined)} The value at the given index of the linked list.\n * If not found, return undefined.\n */\n removeAt(index) {\n if (typeof index !== 'number' || index < 0 || index >= this._linkedList.size) {\n return undefined;\n }\n return this.pop(index);\n }\n\n /**\n * Removes the first occurance of the given value in the linked list and\n * returns true if the given value is in the linked list.\n * @param {*} value - The value to remove\n * @return {boolean} True if the given value is in the linked list else false.\n */\n remove(value) {\n let now = this._linkedList.front;\n while (now) {\n if (now.value === value) {\n break;\n }\n now = now.next;\n }\n\n if (!now) {\n return false;\n }\n\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n return true;\n }\n\n /**\n * Removes the every occurance of the given value in the linked list and\n * returns the number of removed values.\n * @param {*} value - The value to remove\n * @return {number} The number of removed values.\n */\n removeAll(value) {\n let now = this._linkedList.front;\n let result = 0;\n while (now) {\n if (now.value === value) {\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n result += 1;\n }\n now = now.next;\n }\n\n return result;\n }\n\n /**\n * Same with remove(value) if value is given.\n * If value is not given, same with popFirst().\n * @param {*} [value] - The value to remove\n * @return {(*|undefined|boolean)} If remove success, return true.\n * If value not given, return popFirst().\n */\n removeFirst(value) {\n if (value === undefined) {\n return this.popFirst();\n }\n return this.remove(value);\n }\n\n /**\n * Same with remove(value) but find from start searching from last.\n * @param {*} [value] - The value to remove\n * @return {(*|undefined|boolean)} If remove success, return true.\n * If value not given, return popLast().\n */\n removeLast(value) {\n let now = this._linkedList.end;\n while (now) {\n if (now.value === value) {\n break;\n }\n now = now.prev;\n }\n\n if (!now) {\n return false;\n }\n\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n return true;\n }\n\n /**\n * Removes the first value that matches given predicate f and\n * returns value in the linked list.\n * @param {Function} f - Predicate\n * @return {(*|undefined)} Found value. If not found, return undefined.\n * @throws {TypeError} When the given predicate is not a function.\n */\n removeMatch(f) {\n if (typeof f !== 'function') {\n throw TypeError();\n }\n\n let now = this._linkedList.front;\n while (now) {\n if (f(now.value)) {\n break;\n }\n now = now.next;\n }\n\n if (!now) {\n return undefined;\n }\n\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n return now.value;\n }\n\n /**\n * Removes all values that matches given predicate f and\n * returns the removed values.\n * @param {Function} f - Predicate\n * @return {any[]} Removed values.\n * @throws {TypeError} When the given predicate is not a function.\n */\n removeMatchAll(f) {\n if (typeof f !== 'function') {\n throw TypeError();\n }\n\n let now = this._linkedList.front;\n const result = [];\n while (now) {\n if (f(now.value)) {\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n result.push(now.value);\n }\n now = now.next;\n }\n\n return result;\n }\n\n /**\n * Same with removeMatch(f)\n * @param {Function} f - Predicate\n * @return {(*|undefined)} Found value. If not found, return undefined.\n * @throws {TypeError} When the given predicate is not a function.\n */\n removeMatchFirst(f) {\n return this.removeMatch(f);\n }\n\n /**\n * Same with removeMatch(f) but find from start searching from last.\n * @param {Function} f - Predicate\n * @return {(*|undefined)} Found value. If not found, return undefined.\n * @throws {TypeError} When the given predicate is not a function.\n */\n removeMatchLast(f) {\n if (typeof f !== 'function') {\n throw TypeError();\n }\n\n let now = this._linkedList.end;\n while (now) {\n if (f(now.value)) {\n break;\n }\n now = now.prev;\n }\n\n if (!now) {\n return undefined;\n }\n\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n return now.value;\n }\n\n /**\n * Removes all values in the linked list.\n */\n clear() {\n this._linkedList = {\n size: 0,\n front: null,\n end: null,\n };\n }\n\n /**\n * Returns the value at the given index of the linked list.\n * @param {number} index - The index to get the value.\n * @return {*} The value at the given index of the linked list.\n * When the given index < 0 or index >= size of the linked list, return undefined.\n */\n get(index) {\n if (typeof index !== 'number' || index < 0 || index >= this._linkedList.size) {\n return undefined;\n }\n const now = this._getNode(index);\n\n return now.value;\n }\n\n /**\n * Returns the value at the first of the linked list.\n * @return {*} The value at the front of the linked list. If empty, return undefined.\n */\n getFirst() {\n return this.get(0);\n }\n\n /**\n * Returns the value at the end of the linked list.\n * @return {*} The value at the end of the linked list. If empty, return undefined.\n */\n getLast() {\n return this.get(this.size() - 1);\n }\n\n /**\n * Updates the value at the given index of the linked list and\n * returns the value at the given index of the linked list.\n * @param {number} index - The index to update the value.\n * @param {*} value - The value to update.\n * @throws {RangeError} When the given index < 0 or index >= size of the linked list.\n * @return {*} The value at the given index of the linked list.\n */\n set(index, value) {\n if (typeof index !== 'number' || index < 0 || index >= this._linkedList.size) {\n throw RangeError();\n }\n const now = this._getNode(index);\n\n const ret = now.value;\n now.value = value;\n\n return ret;\n }\n\n /**\n * Returns the value of the first element in the linked list\n * that satisfies the provided testing function.\n * @param {function} f - Testing function.\n * @return {*} The the first value in the linked list\n * that satisfies the provided testing function.\n * When no element in the linked list satisfies the provided testing function, return undefined.\n */\n find(f) {\n let now = this._linkedList.front;\n while (now && !f(now.value)) {\n now = now.next;\n }\n if (now) {\n return now.value;\n }\n return undefined;\n }\n\n /**\n * Returns the number of elements in the linked list.\n * @return {number} The number of elements in the linked list.\n */\n size() {\n return this._linkedList.size;\n }\n\n /**\n * Returns whether the linked list is empty.\n * @return {boolean} True if the linked list is empty.\n */\n isEmpty() {\n return this._linkedList.size === 0;\n }\n\n /**\n * For each values in the list, execute the given procedure f.\n * @param {function} f - Procedure to execute\n */\n forEach(f) {\n let now = this._linkedList.front;\n while (now) {\n f(now.value);\n now = now.next;\n }\n }\n\n /**\n * Returns a new LinkedList whose values are mapped with given function f.\n * @param {function} f - Function to map values\n * @return {LinkedList} LinkedList([mapped values])\n */\n map(f) {\n const list = new LinkedList();\n this.forEach(v => list.addLast(f(v)));\n return list;\n }\n\n /**\n * Returns a new LinkedList whose values are mapped with given function f and flattened.\n * @param {function} f - Function (this.value) => iterable\n * @return {LinkedList} LinkedList([mapped and flattened values])\n */\n flatMap(f) {\n const list = new LinkedList();\n this.forEach(v => list.addAllLast([...f(v)]));\n return list;\n }\n\n /**\n * Returns a new LinkedList whose values are filtered with given predicate f.\n * @param {function} f - Predicate (this.value) => boolean\n * @return {LinkedList} LinkedList([filtered values])\n */\n filter(f) {\n const list = new LinkedList();\n this.forEach((v) => {\n if (f(v)) {\n list.addLast(v);\n }\n });\n return list;\n }\n\n /**\n * Returns a new LinkedList whose values are reversed in order.\n * @return {LinkedList} LinkedList([reversed values])\n */\n reversed() {\n const list = new LinkedList();\n this.forEach(v => list.addFirst(v));\n return list;\n }\n\n /**\n * If any of containing values satisfies given f, return true.\n * If none of values satisfy f or not contain any value, return false.\n * @param {function} f - Predicate\n * @return {boolean}\n */\n some(f) {\n if (this.size() === 0) {\n return false;\n }\n\n let now = this._linkedList.front;\n while (now) {\n if (f(now.value)) {\n return true;\n }\n now = now.next;\n }\n return false;\n }\n\n /**\n * If all of containing values satisfies given f or not contain any value, return true.\n * If any of value doesn't satisfy f, return false.\n * @param {function} f - Predicate\n * @return {boolean}\n */\n every(f) {\n let now = this._linkedList.front;\n while (now) {\n if (!f(now.value)) {\n return false;\n }\n now = now.next;\n }\n return true;\n }\n\n /**\n * If contains given value v, return true.\n * @param {*} v\n * @return {boolean}\n */\n includes(v) {\n let now = this._linkedList.front;\n while (now) {\n if (now.value === v) {\n return true;\n }\n now = now.next;\n }\n return false;\n }\n\n * [Symbol.iterator]() {\n let now = this._linkedList.front;\n while (now) {\n yield now.value;\n now = now.next;\n }\n }\n}\n\nmodule.exports = LinkedList;\n","const Utils = require('./utils');\nconst Optional = require('./optional');\nconst Stack = require('./stack');\nconst Queue = require('./queue');\nconst LinkedList = require('./linked-list');\nconst Heap = require('./heap');\nconst BinarySearchTree = require('./binary-search-tree');\n\n/**\n * @namespace sangja\n */\nmodule.exports = {\n Optional,\n Stack,\n Queue,\n LinkedList,\n Heap,\n BinarySearchTree,\n isIterable: Utils.isIterable,\n defaultKey: Utils.defaultKey,\n defaultCompare: Utils.defaultCompare,\n};\n","/**\n * @class\n * @memberof sangja\n */\nclass Optional {\n /**\n * Creates a new Optional.\n * Value parameter is optional. Undefeined for value is not allowed.(Not work well)\n * @constructor\n * @param {*} [value=undefined] - Value to contain\n */\n constructor(value = undefined) {\n this.value = value;\n }\n\n /**\n * Returns the containing value.\n * @returns {*|undefined} The containing value. If it does not contain a value, return undefined\n */\n get() {\n return this.value;\n }\n\n /**\n * Returns the containing value.\n * @returns {*} The containing value. If it does not contain a value, return undefined\n */\n getOrElse(value) {\n if (this.value === undefined) {\n return value;\n }\n return this.value;\n }\n\n /**\n * If the optional contains a value, returns 1 else 0.\n * @returns {number} The number of elements in the optional(0 or 1)\n */\n size() {\n if (this.value === undefined) {\n return 0;\n }\n return 1;\n }\n\n /**\n * If the optional is empty, returns true else returns false.\n * @returns {boolean} True if the optional is empty else false\n */\n isEmpty() {\n if (this.value === undefined) {\n return true;\n }\n return false;\n }\n\n /**\n * If the optional contains a value, execute the given function f.\n * @param {function} f - Function to execute\n */\n forEach(f) {\n if (this.value === undefined) {\n return;\n }\n f(this.value);\n }\n\n /**\n * If the optional contains a value, execute the given function f\n * and returns the new optional containing f(this.value).<br>\n * If the optional is empty or catch error while executing f, returns empty optional.\n * @param {function} f - Function to execute with this.value\n * @return {Optional} Optional(f(this.value)) or Optional()\n */\n map(f) {\n if (this.value === undefined) {\n return new Optional();\n }\n\n try {\n return new Optional(f(this.value));\n } catch (err) {\n return new Optional();\n }\n }\n\n /**\n * If the optional contains a value, execute the given function f\n * and flatten the result.<br>\n * Returns the new optional containing flatten result of f(this.value)<br>\n * If the optional is empty or catch error while executing f, returns empty optional.\n * @param {function} f - (this.value) => Optional\n * @return {Optional} Optional(...f(this.value)) or Optional()\n */\n flatMap(f) {\n if (this.value === undefined) {\n return new Optional();\n }\n\n try {\n return new Optional(...f(this.value));\n } catch (err) {\n return new Optional();\n }\n }\n\n /**\n * If the contained value satisfies the predicate, return this.\n * If the optional is empty or given predicate returns false, returns empty optional.\n * @param {function} f - Predicate\n * @return {Optional} Optional(this.value) or Optional()\n */\n filter(f) {\n if (this.value === undefined) {\n return new Optional();\n }\n\n if (f(this.value)) {\n return this;\n }\n return new Optional();\n }\n\n /**\n * If containing value satisfies given f, return true.\n * If not satisfy f or not contain any value, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n some(f) {\n if (this.value === undefined) {\n return false;\n }\n return Boolean(f(this.value));\n }\n\n /**\n * If not contain any value or containing value satisfies given f, return true.\n * If not satisfy f, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n every(f) {\n if (this.value === undefined) {\n return true;\n }\n return Boolean(f(this.value));\n }\n\n /**\n * If contains given value v, return true.\n * @param {*} v\n * @returns {boolean}\n */\n includes(v) {\n if (this.value !== undefined && this.value === v) {\n return true;\n }\n return false;\n }\n\n * [Symbol.iterator]() {\n if (this.value !== undefined) {\n yield this.value;\n }\n }\n}\n\nmodule.exports = Optional;\n","const Utils = require('./utils');\n\n/**\n * @class\n * @memberof sangja\n */\nclass Stack {\n /**\n * Creates a new Stack.\n * Iterable parameter is optional.\n * @constructor\n * @param {iterable} [iterable] - Iterator for initialize the stack.\n * @throws {TypeError} When given parameter is not stack.\n */\n constructor(iterable = []) {\n if (!Utils.isIterable(iterable)) {\n throw TypeError();\n }\n this._stack = [...iterable];\n }\n\n /**\n * Add value at the top of the stack.\n * @param {*} value - The value to push to the stack.\n */\n push(value) {\n this._stack.push(value);\n }\n\n /**\n * Add values in the given iterator at the top of the stack.\n * @param {iterable} iterable - The iterable values to push to the stack.\n */\n pushAll(iterable) {\n [...iterable].forEach(v => this._stack.push(v));\n }\n\n /**\n * Removes the top of the stack and returns the value at the top of the stack.\n * @returns {*} The value at the top of the stack. If empty, return undefined.\n */\n pop() {\n if (this._stack.length === 0) {\n return undefined;\n }\n\n return this._stack.pop();\n }\n\n /**\n * Returns the value at the top of the stack without changing the state of the stack.\n * @returns {*} The value at the top of the stack. If empty, return undefined.\n */\n top() {\n if (this._stack.length === 0) {\n return undefined;\n }\n\n return this._stack[this._stack.length - 1];\n }\n\n /**\n * Removes all values in the stack.\n */\n clear() {\n this._stack = [];\n }\n\n /**\n * Returns the number of elements in the stack.\n * @returns {number} The number of elements in the stack.\n */\n size() {\n return this._stack.length;\n }\n\n /**\n * Returns whether the stack is empty.\n * @returns {boolean} True if the stack is empty.\n */\n isEmpty() {\n return this._stack.length === 0;\n }\n\n /**\n * For each values in the stack, execute the given procedure f.<br>\n * *Executing order is top to bottom*\n * @param {function} f - Procedure to execute\n */\n forEach(f) {\n for (let i = this._stack.length - 1; i >= 0; i -= 1) {\n f(this._stack[i]);\n }\n }\n\n /**\n * Returns a stack whose values are mapped with given function f.\n * @param {function} f - Function to map values\n * @return {Stack} Stack([mapped values])\n */\n map(f) {\n const stack = new Stack();\n stack._stack = this._stack.map(f);\n return stack;\n }\n\n /**\n * Returns a stack whose values are mapped with given function f and flattened.\n * @param {function} f - Function (this.value) => iterable\n * @return {Stack} Stack([mapped and flattened values])\n */\n flatMap(f) {\n const stack = new Stack();\n // [...this._stack.map(f)].forEach(arr => arr.forEach(v => stack.push(v)));\n this._stack.map(f).forEach(arr => stack.pushAll(arr));\n return stack;\n }\n\n /**\n * Returns a stack whose values are filtered with given predicate f.\n * @param {function} f - Predicate (this.value) => boolean\n * @return {Stack} Stack([filtered values])\n */\n filter(f) {\n const stack = new Stack();\n stack._stack = this._stack.filter(f);\n return stack;\n }\n\n /**\n * Returns a stack whose values are reversed in order.\n * @return {Stack} Stack([reversed values])\n */\n reversed() {\n return new Stack(this);\n }\n\n /**\n * If any of containing values satisfies given f, return true.\n * If none of values satisfy f or not contain any value, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n some(f) {\n return this._stack.some(f);\n }\n\n /**\n * If all of containing values satisfies given f or not contain any value, return true.\n * If any of value doesn't satisfy f, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n every(f) {\n return this._stack.every(f);\n }\n\n /**\n * If contains given value v, return true.\n * @param {*} v\n * @returns {boolean}\n */\n includes(v) {\n return this._stack.includes(v);\n }\n\n * [Symbol.iterator]() {\n for (let i = this._stack.length - 1; i >= 0; i -= 1) {\n yield this._stack[i];\n }\n }\n}\n\nmodule.exports = Stack;\n","const Utils = require('./utils');\n\n/**\n * @class\n * @memberof sangja\n */\nclass Heap {\n /**\n * Creates a new Heap.\n * By default, max-heap is created.\n * Iterable a and option object b are optional. But if both are given, a must precede b.\n * @constructor\n * @param {iterable} [a=[]] - Iterator for initialize\n * @param {Object} [b={}] - Option object for initialize\n * @param {function} [b.key=sangja.defaultKey] - Key function for each value.\n * Each value should be comparable with given key.\n * @param {function} [b.compare=sangja.defaultCompare] - Compare function.<br>\n * If x precede y, compare(key(x), key(y)) < 0<br>\n * If y precede x, compare(key(x), key(y)) > 0<br>\n * If the order of x and y is the same, compare(key(x), key(y)) == 0\n * @param {function} [b.reverse=false] - If true, compare result is inverted.\n */\n constructor(a = {}, b = {}) {\n // null, null -> iterator: [], key,compare: default\n // iterator, null -> iterator: ok, key,compare: default\n // option, null -> iterator: [], key,compare: option\n // iterator, option -> iterator: ok, key,compare: option\n let iterator = null;\n let key = null;\n let compare = null;\n let reverse = null;\n if (Utils.isIterable(a)) {\n iterator = a;\n // If a is an iterable, b will be an option object.(If not given, {})\n ({ key, compare, reverse } = b);\n } else {\n iterator = [];\n // If a is not an iterable, a will be an option object.(If not given, {})\n ({ key, compare, reverse } = a);\n }\n\n this._heap = [0];\n this._options = {\n key: key || Utils.defaultKey,\n compare: compare || Utils.defaultCompare,\n reverse: reverse || false,\n };\n\n this._key = this._options.key;\n if (this._options.reverse) {\n this._compare = (x, y) => this._options.compare(this._key(y), this._key(x));\n } else {\n this._compare = (x, y) => this._options.compare(this._key(x), this._key(y));\n }\n\n [...iterator].forEach(v => this.add(v));\n }\n\n /**\n * Add value to the the heap.\n * @param {*} value - The value to add\n */\n add(value) {\n this._heap.push(value);\n\n let now = this._heap.length - 1;\n let next = Math.floor(now / 2);\n while (now > 1 && this._compare(this._heap[next], this._heap[now]) < 0) {\n const tmp = this._heap[next];\n this._heap[next] = this._heap[now];\n this._heap[now] = tmp;\n\n now = next;\n next = Math.floor(now / 2);\n }\n }\n\n /**\n * Add values to the the heap.\n * @param {iterable} iterable - The iterable object that contain values to add.\n */\n addAll(iterable) {\n [...iterable].forEach(v => this.add(v));\n }\n\n /**\n * Removes the root of the heap and returns the value.\n * @returns {*} The value at the root of the heap. If empty, return undefined.\n */\n pop() {\n if (this._heap.length === 1) {\n return undefined;\n }\n if (this._heap.length === 2) {\n return this._heap.pop();\n }\n\n const value = this._heap[1];\n this._heap[1] = this._heap.pop();\n\n let now = 1;\n while (now < this._heap.length) {\n const left = now * 2;\n const right = now * 2 + 1;\n // If now < right child, now <- max(left, right) and continue\n if (right < this._heap.length\n && this._compare(this._heap[now], this._heap[right]) < 0) {\n let next = null;\n if (this._compare(this._heap[left], this._heap[right]) < 0) {\n next = right;\n } else {\n next = left;\n }\n const tmp = this._heap[now];\n this._heap[now] = this._heap[next];\n this._heap[next] = tmp;\n now = next;\n } else if (left < this._heap.length\n && this._compare(this._heap[now], this._heap[left]) < 0) {\n const tmp = this._heap[now];\n this._heap[now] = this._heap[left];\n this._heap[left] = tmp;\n now = left;\n } else {\n break;\n }\n }\n return value;\n }\n\n /**\n * Returns the value at the root of the heap without changing the state of the heap.\n * @returns {*} The value at the root of the heap. If empty, return undefined.\n */\n peek() {\n if (this._heap.length === 1) {\n return undefined;\n }\n\n return this._heap[1];\n }\n\n /**\n * Returns the value of the first element in the heap\n * that satisfies the given predicate.<br>\n * Searches matching value by bfs order.\n * @param {function} f - Predicate\n * @returns {(*|undefined)} The the first value in the heap\n * that satisfies the provided testing function.\n * When no element in the heap satisfies the provided testing function, return undefined.\n */\n find(f) {\n for (let i = 1; i < this._heap.length; i += 1) {\n if (f(this._heap[i])) {\n return this._heap[i];\n }\n }\n return undefined;\n }\n\n /**\n * Returns the number of elements in the heap.\n * @returns {number} The number of elements in the heap.\n */\n size() {\n return this._heap.length - 1;\n }\n\n /**\n * Returns whether the heap is empty.\n * @returns {boolean} True if the heap is empty.\n */\n isEmpty() {\n return this._heap.length === 1;\n }\n\n /**\n * Removed all elements in the heap.\n */\n clear() {\n this._heap = [0];\n }\n\n /**\n * Execute the given procedure f for each values.\n * @param {function} f - Procedure to execute\n */\n forEach(f) {\n const heapForIter = new Heap(this._heap.slice(1), this._options);\n while (!heapForIter.isEmpty()) {\n f(heapForIter.pop());\n }\n }\n\n /**\n * Returns a new Heap mapped with given function f.\n * @param {function} f - Function\n * @param {Object} [options=this._options] - Option object for initialize the heap.<br>\n * If not given, inherits from this.\n * If only a portion is given, ingerits those that are not given.\n * @return {Heap} Heap([mapped values])\n */\n map(f, options) {\n const heap = new Heap(Utils.mergeOptions(options, this._options));\n this.forEach(v => heap.add(f(v)));\n return heap;\n }\n\n /**\n * Returns a new Heap whose values are mapped with given function f and flattened.\n * @param {function} f - Function (this.value) => iterable\n * @param {Object} [options=this._options] - Option object for initialize the heap.<br>\n * If not given, inherits from this.\n * If only a portion is given, ingerits those that are not given.\n * @return {Heap} Heap([mapped and flattened values])\n */\n flatMap(f, options) {\n const heap = new Heap(Utils.mergeOptions(options, this._options));\n this.forEach(v => heap.addAll([...f(v)]));\n return heap;\n }\n\n /**\n * Returns a new Heap whose values are filtered with given predicate f.\n * @param {function} f - Predicate (this.value) => boolean\n * @param {Object} [options=this._options] - Option object for initialize the heap.<br>\n * If not given, inherits from this.\n * If only a portion is given, ingerits those that are not given.\n * @return {Heap} Heap([filtered values])\n */\n filter(f, options) {\n const heap = new Heap(Utils.mergeOptions(options, this._options));\n this.forEach((v) => {\n if (f(v)) {\n heap.add(v);\n }\n });\n return heap;\n }\n\n /**\n * Return new heap with same items, but reversed option is inverted from this.\n * @return {Heap} Heap([reversed values])\n */\n reversed() {\n return new Heap(this, Utils.mergeOptions({ reverse: !this._options.reverse }, this._options));\n }\n\n /**\n * If any of containing values satisfies given f, return true.\n * If none of values satisfy f or not contain any value, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n some(f) {\n for (let i = 1; i < this._heap.length; i += 1) {\n if (f(this._heap[i])) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * If all of containing values satisfies given f or not contain any value, return true.\n * If any of value doesn't satisfy f, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n every(f) {\n for (let i = 1; i < this._heap.length; i += 1) {\n if (!f(this._heap[i])) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * If contains given value v, return true.\n * @param {*} v\n * @returns {boolean}\n */\n includes(v) {\n for (let i = 1; i < this._heap.length; i += 1) {\n if (this._heap[i] === v) {\n return true;\n }\n }\n return false;\n }\n\n * [Symbol.iterator]() {\n // Use other heap!\n const heapForIter = new Heap(this._heap.slice(1), this._options);\n\n while (!heapForIter.isEmpty()) {\n yield heapForIter.pop();\n }\n }\n\n /**\n * Returns breadth first iterator.\n * @param {Function} [f] - If f is given, execute f by bfs order.\n * @returns {(generator|undefined)} Tree breadth first iterator. If f if given, not return.\n */\n // eslint-disable-next-line consistent-return\n breadthFirst(f) {\n if (!f) {\n const that = this;\n return (function* _breadthFirst() {\n for (let i = 1; i < that._heap.length; i += 1) {\n yield that._heap[i];\n }\n }());\n }\n for (let i = 1; i < this._heap.length; i += 1) {\n f(this._heap[i]);\n }\n }\n}\n\nmodule.exports = Heap;\n","const Utils = require('./utils');\nconst Queue = require('./queue');\n\n/**\n * @class\n * @memberof sangja\n */\nclass BinarySearchTree {\n /**\n * Creates a new BinarySearchTree.\n * Iterable a and option object b are optional. But if both are given, a must precede b.\n * @constructor\n * @param {iterable} [a=[]] - Iterator for initialize\n * @param {Object} [b={}] - Option object\n * @param {function} [b.key=utils.defaultKey] - Key function for each value.\n * Each value should be comparable with given key.\n * @param {function} [b.compare=utils.defaultCompare] - Compare function.<br>\n * If x precede y, compare(key(x), key(y)) < 0<br>\n * If y precede x, compare(key(x), key(y)) > 0<br>\n * If the order of x and y is the same, compare(key(x), key(y)) == 0\n * @param {function} [b.reverse=false] - If true, compare result is inverted.\n */\n constructor(a = {}, b = {}) {\n // null, null -> iterator: [], key,compare: default\n // iterator, null -> iterator: ok, key,compare: default\n // option, null -> iterator: [], key,compare: option\n // iterator, option -> iterator: ok, key,compare: option\n let iterator = null;\n let key = null;\n let compare = null;\n let reverse = null;\n if (Utils.isIterable(a)) {\n iterator = a;\n // If a is an iterable, b will be an option object.(If not given, {})\n ({ key, compare, reverse } = b);\n } else {\n iterator = [];\n // If a is not an iterable, a will be an option object.(If not given, {})\n ({ key, compare, reverse } = a);\n }\n\n this._root = null;\n this._options = {\n key: key || Utils.defaultKey,\n compare: compare || Utils.defaultCompare,\n reverse: reverse || false,\n };\n\n this._key = this._options.key;\n if (this._options.reverse) {\n this._compare = (x, y) => this._options.compare(this._key(y), this._key(x));\n } else {\n this._compare = (x, y) => this._options.compare(this._key(x), this._key(y));\n }\n\n [...iterator].forEach(v => this.add(v));\n }\n\n /**\n * Add value to the tree.\n * @param {*} value - The value to add to the tree.\n */\n add(value) {\n if (this._root == null) {\n this._root = {\n left: null,\n right: null,\n children: 0,\n value,\n };\n return;\n }\n\n let parent = null;\n let now = this._root;\n let direction = null; // 0 if left else 1;\n while (now) {\n parent = now;\n now.children += 1;\n if (this._compare(value, now.value) <= 0) {\n now = now.left;\n direction = 0;\n } else {\n now = now.right;\n direction = 1;\n }\n }\n\n now = {\n left: null,\n right: null,\n children: 0,\n value,\n };\n if (direction === 0) {\n parent.left = now;\n } else {\n parent.right = now;\n }\n }\n\n /**\n * Add values to the the tree.\n * @param {iterable} iterable - The iterable object that contain values to add.\n */\n addAll(iterable) {\n [...iterable].forEach(v => this.add(v));\n }\n\n /**\n * Removes the lowest value of the tree and returns the value.\n * @returns {*} The lowest value of the tree. If empty, return undefined.\n */\n pop() {\n if (this._root === null) {\n return undefined;\n }\n\n let parent = null;\n let now = this._root;\n while (now.left) {\n now.children -= 1;\n parent = now;\n now = now.left;\n }\n\n if (parent !== null) {\n parent.left = now.right;\n } else {\n this._root = now.right;\n }\n\n return now.value;\n }\n\n /**\n * Removes the given value in the tree and returns the value.\n * @returns {(*|undefined)} The lowest value of the tree. If empty or not found, return undefined.\n */\n remove(v) {\n if (this._root === null || !this.includes(v)) {\n return undefined;\n }\n\n let parent = null;\n let now = this._root;\n while (now) {\n const comp = this._compare(this._key(v), this._key(now.value));\n if (comp === 0) {\n break;\n } else if (comp < 0) {\n now.children -= 1;\n parent = now;\n now = now.left;\n } else {\n now.children -= 1;\n parent = now;\n now = now.right;\n }\n }\n\n // Not found\n if (now === null) {\n return undefined;\n }\n\n // If now has both child, move left rightmost child.\n if (now.left && now.right) {\n let rightmostParent = now;\n let rightmost = now.left;\n while (rightmost.right) {\n rightmostParent.children -= 1;\n rightmostParent = rightmost;\n rightmost = rightmost.right;\n }\n if (rightmostParent !== now) {\n // Found rightmost.\n rightmostParent.right = rightmost.left;\n } else {\n // Rightmost is now.left\n rightmostParent.left = rightmost.left;\n }\n const result = now.value;\n now.value = rightmost.value;\n return result;\n }\n\n // If now has left child, remove now.\n if (now.left) {\n if (now === this._root) {\n this._root = now.left;\n } else if (parent.left === now) {\n parent.left = now.left;\n } else {\n parent.right = now.left;\n }\n return now.value;\n }\n\n // If now has right child, remove now.\n if (now.right) {\n if (now === this._root) {\n this._root = now.right;\n } else if (parent.left === now) {\n parent.left = now.right;\n } else {\n parent.right = now.right;\n }\n return now.value;\n }\n\n // If now is left, remove now from parent.\n if (now === this._root) {\n this._root = null;\n } else if (parent.left === now) {\n parent.left = null;\n } else {\n parent.right = null;\n }\n return now.value;\n }\n\n /**\n * Removes a value that matches given predicate f and\n * returns value in the linked list.\n * @param {Function} f - Predicate\n * @returns {(*|undefined)} Found value. If not found, return undefined.\n * @throws {TypeError} When the given predicate is not a function.\n */\n removeMatch(f) {\n if (typeof f !== 'function') {\n throw TypeError();\n }\n\n if (this.isEmpty()) {\n return undefined;\n }\n\n function _getMatch(node) {\n if (f(node.value)) {\n return node.value;\n }\n return (node.left && _getMatch(node.left))\n || (node.right && _getMatch(node.right));\n }\n const removeVal = _getMatch(this._root);\n this.remove(removeVal);\n return removeVal;\n }\n\n /**\n * Returns the lowest value of the tree without changing the state of the tree.\n * @returns {*} The lowest value of the tree. If empty, return undefined.\n */\n peek() {\n if (this._root === null) {\n return undefined;\n }\n\n let now = this._root;\n while (now) {\n if (now.left) {\n now = now.left;\n }\n }\n\n return now.value;\n }\n\n /**\n * Returns the value of the first element in the binary search tree\n * that satisfies the given predicate.<br>\n * Searches matching value by dfs order(preorder).\n * @param {function} f - Predicate\n * @returns {(*|undefined)} The the first value in the binary search tree\n * that satisfies the provided testing function.\n * When no element in the binary search tree satisfies\n * the provided testing function, return undefined.\n */\n find(f) {\n const nodes = [this._root];\n while (nodes.length > 0) {\n const now = nodes.pop();\n if (now) {\n if (f(now.value)) {\n return now.value;\n }\n nodes.push(now.left);\n nodes.push(now.right);\n }\n }\n return undefined;\n }\n\n /**\n * Returns the number of elements in the tree.\n * @returns {number} The number of elements in the tree.\n */\n size() {\n if (this._root === null) {\n return 0;\n }\n\n return this._root.children + 1;\n }\n\n /**\n * Returns whether the tree is empty.\n * @returns {boolean} True if the tree is empty.\n */\n isEmpty() {\n return this._root === null;\n }\n\n /**\n * Removed all elements in the tree.\n */\n clear() {\n this._root = null;\n }\n\n /**\n * Execute the given procedure f for each values.\n * @param {function} f - Procedure to execute\n */\n forEach(f) {\n function _forEach(node) {\n if (node) {\n f(node.value);\n _forEach(node.left);\n _forEach(node.right);\n }\n }\n\n _forEach(this._root);\n }\n\n /**\n * Returns a new BinarySearchTree mapped with given function f.\n * @param {function} f - Function\n * @param {Object} [options=this._options] - Option object for initialize.<br>\n * If not given, inherits from this.\n * If only a portion is given, ingerits those that are not given.\n * @return {BinarySearchTree} BinarySearchTree([mapped values])\n */\n map(f, options) {\n const tree = new this.constructor(Utils.mergeOptions(options, this._options));\n this.forEach(v => tree.add(f(v)));\n return tree;\n }\n\n /**\n * Returns a new BinarySearchTree whose values are mapped with given function f and flattened.\n * @param {function} f - Function (this.value) => iterable\n * @param {Object} [options=this._options] - Option object for initialize.<br>\n * If not given, inherits from this.\n * If only a portion is given, ingerits those that are not given.\n * @return {BinarySearchTree} BinarySearchTree([mapped and flattened values])\n */\n flatMap(f, options) {\n const tree = new this.constructor(Utils.mergeOptions(options, this._options));\n this.forEach(v => tree.addAll([...f(v)]));\n return tree;\n }\n\n /**\n * Returns a new BinarySearchTree whose values are filtered with given predicate f.\n * @param {function} f - Predicate (this.value) => boolean\n * @param {Object} [options=this._options] - Option object for initialize.<br>\n * If not given, inherits from this.\n * If only a portion is given, ingerits those that are not given.\n * @return {BinarySearchTree} BinarySearchTree([filtered values])\n */\n filter(f, options) {\n const tree = new this.constructor(Utils.mergeOptions(options, this._options));\n this.forEach((v) => {\n if (f(v)) {\n tree.add(v);\n }\n });\n return tree;\n }\n\n /**\n * Return new tree with same items, but reversed option is inverted from this.\n * @return {BinarySearchTree} BinarySearchTree([reversed values])\n */\n reversed() {\n return new this.constructor(this,\n Utils.mergeOptions({ reverse: !this._options.reverse }, this._options));\n }\n\n /**\n * If any of containing values satisfies given f, return true.\n * If none of values satisfy f or not contain any value, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n some(f) {\n function _some(node) {\n return f(node.value)\n || Boolean(node.left && _some(node.left))\n || Boolean(node.right && _some(node.right));\n }\n return Boolean(this._root) && _some(this._root);\n }\n\n /**\n * If all of containing values satisfies given f or not contain any value, return true.\n * If any of value doesn't satisfy f, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n every(f) {\n function _every(node) {\n return f(node.value)\n && Boolean(!node.left || _every(node.left))\n && Boolean(!node.right || _every(node.right));\n }\n return !this._root || _every(this._root);\n }\n\n /**\n * If contains given value v, return true.\n * @param {*} v\n * @returns {boolean}\n */\n includes(v) {\n let now = this._root;\n while (now) {\n const comp = this._compare(this._key(v), this._key(now.value));\n if (comp === 0) {\n return true;\n }\n if (comp < 0) {\n now = now.left;\n } else {\n now = now.right;\n }\n }\n return false;\n }\n\n /**\n * Returns whether the tree is empty.\n * @name Symbol.iterator\n * @generator\n * @property {generator}\n * @returns {boolean} True if the tree is empty.\n */\n * [Symbol.iterator]() {\n yield* this.inorder();\n }\n\n /**\n * Returns inorder iterator.\n * @param {Function} [f] - If f is given, execute f by inorder.\n * @returns {(generator|undefined)} Tree inorder iterator. If f if given, not return.\n */\n // eslint-disable-next-line consistent-return\n inorder(f) {\n if (!f) {\n return (function* _inorderIterator(node) {\n if (node !== null) {\n yield* _inorderIterator(node.left);\n yield node.value;\n yield* _inorderIterator(node.right);\n }\n }(this._root));\n }\n\n function _inorder(node) {\n if (node !== null) {\n _inorder(node.left);\n f(node.value);\n _inorder(node.right);\n }\n }\n _inorder(this._root);\n }\n\n /**\n * Returns preorder iterator.\n * @param {Function} [f] - If f is given, execute f by preorder.\n * @returns {(generator|undefined)} Tree preorder iterator. If f if given, not return.\n */\n // eslint-disable-next-line consistent-return\n preorder(f) {\n if (!f) {\n return (function* _preorderIterator(node) {\n if (node !== null) {\n yield node.value;\n yield* _preorderIterator(node.left);\n yield* _preorderIterator(node.right);\n }\n }(this._root));\n }\n\n function _preorder(node) {\n if (node !== null) {\n f(node.value);\n _preorder(node.left);\n _preorder(node.right);\n }\n }\n _preorder(this._root);\n }\n\n /**\n * Returns postorder iterator.\n * @param {Function} [f] - If f is given, execute f by postorder.\n * @returns {(generator|undefined)} Tree postorder iterator. If f if given, not return.\n */\n // eslint-disable-next-line consistent-return\n postorder(f) {\n if (!f) {\n return (function* _postorderIterator(node) {\n if (node !== null) {\n yield* _postorderIterator(node.left);\n yield* _postorderIterator(node.right);\n yield node.value;\n }\n }(this._root));\n }\n\n function _postorder(node) {\n if (node !== null) {\n _postorder(node.left);\n _postorder(node.right);\n f(node.value);\n }\n }\n _postorder(this._root);\n }\n\n /**\n * Returns breadth first iterator.\n * @param {Function} [f] - If f is given, execute f by breadth first.\n * @returns {(generator|undefined)} Tree breadth first iterator. If f if given, not return.\n */\n // eslint-disable-next-line consistent-return\n breadthFirst(f) {\n if (!f) {\n return (function* _breadthFirstIterator(root) {\n const queue = new Queue();\n queue.enqueue(root);\n while (queue.size() > 0) {\n const now = queue.dequeue();\n if (now !== undefined && now !== null) {\n yield now.value;\n queue.enqueue(now.left);\n queue.enqueue(now.right);\n }\n }\n }(this._root));\n }\n\n function _breadthFirst(root) {\n const queue = new Queue();\n queue.enqueue(root);\n while (queue.size() > 0) {\n const now = queue.dequeue();\n if (now !== undefined && now !== null) {\n f(now.value);\n queue.enqueue(now.left);\n queue.enqueue(now.right);\n }\n }\n }\n _breadthFirst(this._root);\n }\n}\n\nmodule.exports = BinarySearchTree;\n"],"sourceRoot":""}