UNPKG

libstl

Version:

Standard JavaScript/TypeScript Library: DoublyLinkedList, Stack, Queue, Heap, MaxHeap, MinHeap, PriorityQueue

940 lines 30.6 kB
{ "project": { "name": "libstl", "description": "Standard TypeScript/JavaScript Library: DoublyLinkedList, Stack, Queue, Heap, MaxHeap, MinHeap, PriorityQueue", "logo": "https://vovazolotoy.github.io/docs/libstl.png", "version": "0.1.21" }, "files": { "Datastructures/DoublyLinkedList.ts": { "name": "Datastructures/DoublyLinkedList.ts", "modules": {}, "classes": { "DoublyLinkedList": 1 }, "fors": {}, "namespaces": {} }, "Datastructures/Heap.ts": { "name": "Datastructures/Heap.ts", "modules": {}, "classes": { "Heap": 1 }, "fors": {}, "namespaces": {} }, "Datastructures/MaxHeap.ts": { "name": "Datastructures/MaxHeap.ts", "modules": {}, "classes": { "MaxHeap": 1 }, "fors": {}, "namespaces": {} }, "Datastructures/MinHeap.ts": { "name": "Datastructures/MinHeap.ts", "modules": {}, "classes": { "MinHeap": 1 }, "fors": {}, "namespaces": {} }, "Datastructures/PriorityQueue.ts": { "name": "Datastructures/PriorityQueue.ts", "modules": {}, "classes": { "PriorityQueue": 1, "PriorityQueueNode": 1 }, "fors": {}, "namespaces": {} }, "Datastructures/Queue.ts": { "name": "Datastructures/Queue.ts", "modules": {}, "classes": { "Queue": 1 }, "fors": {}, "namespaces": {} }, "Datastructures/Stack.ts": { "name": "Datastructures/Stack.ts", "modules": {}, "classes": { "Stack": 1 }, "fors": {}, "namespaces": {} } }, "modules": {}, "classes": { "DoublyLinkedList": { "name": "DoublyLinkedList", "shortname": "DoublyLinkedList", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], "file": "Datastructures/DoublyLinkedList.ts", "line": 1, "description": "The DoublyLinkedList class provides the main functionality of a doubly linked list." }, "Heap": { "name": "Heap", "shortname": "Heap", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], "file": "Datastructures/Heap.ts", "line": 1, "description": "The Heap class provides the main functionality of a Heap." }, "MaxHeap": { "name": "MaxHeap", "shortname": "MaxHeap", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], "file": "Datastructures/MaxHeap.ts", "line": 4, "description": "The MaxHeap class provides the main functionality of a heap, keeping the maximum on the top.", "extends": "Heap" }, "MinHeap": { "name": "MinHeap", "shortname": "MinHeap", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], "file": "Datastructures/MinHeap.ts", "line": 4, "description": "The MinHeap class provides the main functionality of a heap, keeping the minimum on the top.", "extends": "Heap" }, "PriorityQueue": { "name": "PriorityQueue", "shortname": "PriorityQueue", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], "file": "Datastructures/PriorityQueue.ts", "line": 4, "description": "The PriorityQueue class provides the main functionality of an prioritized queue, implemented using a max heap.", "extends": "Heap" }, "PriorityQueueNode": { "name": "PriorityQueueNode", "shortname": "PriorityQueueNode", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], "file": "Datastructures/PriorityQueue.ts", "line": 66, "description": "PriorityQueue Node" }, "Queue": { "name": "Queue", "shortname": "Queue", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], "file": "Datastructures/Queue.ts", "line": 4, "description": "The Queue class provides the main functionality of a queue implemented using a doubly linked list.", "extends": "DoublyLinkedList" }, "Stack": { "name": "Stack", "shortname": "Stack", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], "file": "Datastructures/Stack.ts", "line": 4, "description": "The Stack class provides the main functionality of a stack implemented using a doubly linked list.", "extends": "DoublyLinkedList" } }, "classitems": [ { "file": "Datastructures/DoublyLinkedList.ts", "line": 8, "description": "Count of elements in list", "itemtype": "property", "name": "_length", "type": "number", "access": "private", "tagname": "", "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 17, "description": "Iteration pointer", "itemtype": "property", "name": "_key", "type": "number", "access": "private", "tagname": "", "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 26, "description": "Reference to head(first) element in list", "itemtype": "property", "name": "_head", "type": "DoublyLinkedListNode", "access": "private", "tagname": "", "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 35, "description": "Reference to tail(last) element in list", "itemtype": "property", "name": "_tail", "type": "DoublyLinkedListNode", "access": "private", "tagname": "", "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 44, "description": "Reference to iterated element in list", "itemtype": "property", "name": "_current", "type": "DoublyLinkedListNode", "access": "private", "tagname": "", "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 53, "description": "Insert a new value at the specified index", "itemtype": "method", "name": "add", "params": [ { "name": "index", "description": "The index where the new value is to be inserted." }, { "name": "value", "description": "The new value for the index." } ], "return": { "description": "void" }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 77, "description": "Pops a node from the end of the doubly linked list", "itemtype": "method", "name": "pop", "return": { "description": "any The value of the popped node." }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 106, "description": "Shifts a node from the beginning of the doubly linked list", "itemtype": "method", "name": "shift", "return": { "description": "any The value of the shifted node." }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 130, "description": "Pushes an element at the end of the doubly linked list", "itemtype": "method", "name": "push", "params": [ { "name": "value", "description": "The value to push." } ], "return": { "description": "void" }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 155, "description": "Prepends the doubly linked list with an element", "itemtype": "method", "name": "unshift", "params": [ { "name": "value", "description": "The value to unshift." } ], "return": { "description": "void" }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 180, "description": "Peeks at the node from the end of the doubly linked list", "itemtype": "method", "name": "top", "return": { "description": "any The value of the last node." }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 191, "description": "Peeks at the node from the beginning of the doubly linked list", "itemtype": "method", "name": "bottom", "return": { "description": "any The value of the first node." }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 202, "description": "Counts the number of elements in the doubly linked list", "itemtype": "method", "name": "count", "return": { "description": "number the number of elements in the doubly linked list." }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 212, "description": "Checks whether the doubly linked list is empty", "itemtype": "method", "name": "isEmpty", "return": { "description": "boolean whether the doubly linked list is empty." }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 222, "description": "Rewind iterator back to the start", "itemtype": "method", "name": "rewind", "return": { "description": "void" }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 233, "description": "Return current list entry", "itemtype": "method", "name": "current", "return": { "description": "any The current node value." }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 246, "description": "Return current node index", "itemtype": "method", "name": "key", "return": { "description": "any The current node index." }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 256, "description": "Move to next entry", "itemtype": "method", "name": "next", "return": { "description": "void" }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 267, "description": "Move to previous entry", "itemtype": "method", "name": "prev", "return": { "description": "void" }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 278, "description": "Check whether the doubly linked list contains more nodes", "itemtype": "method", "name": "valid", "return": { "description": "boolean true if the doubly linked list contains any more nodes, false otherwise." }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 288, "description": "Export the list to array", "itemtype": "method", "name": "toArray", "return": { "description": "Array The exported array" }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 304, "description": "Serializes the list to string", "itemtype": "method", "name": "toString", "return": { "description": "string The serialized string." }, "class": "DoublyLinkedList" }, { "file": "Datastructures/DoublyLinkedList.ts", "line": 316, "description": "DoublyLinkedList element", "interface": "", "class": "DoublyLinkedList" }, { "file": "Datastructures/Heap.ts", "line": 8, "description": "Max heap flag", "itemtype": "property", "name": "MAX", "type": "number", "static": 1, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 17, "description": "Min heap flag", "itemtype": "property", "name": "MIN", "type": "number", "static": 1, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 26, "description": "Binary tree storage array", "itemtype": "property", "name": "_tree", "type": "Array", "access": "private", "tagname": "", "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 35, "description": "Heap type", "itemtype": "property", "name": "_type", "type": "number", "access": "private", "tagname": "", "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 44, "description": "Iteration pointer", "itemtype": "property", "name": "_key", "type": "number", "access": "private", "tagname": "", "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 53, "description": "Get index of left child element in binary tree stored in array", "itemtype": "method", "name": "_child", "params": [ { "name": "n", "description": "" } ], "return": { "description": "number" }, "access": "private", "tagname": "", "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 65, "description": "Get index of parent element in binary tree stored in array", "itemtype": "method", "name": "_parent", "params": [ { "name": "n", "description": "" } ], "return": { "description": "number" }, "access": "private", "tagname": "", "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 77, "description": "Swap 2 elements in binary tree", "itemtype": "method", "name": "_swap", "params": [ { "name": "first", "description": "" }, { "name": "second", "description": "" } ], "access": "private", "tagname": "", "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 91, "description": "Sift elements in binary tree", "itemtype": "method", "name": "_siftUp", "params": [ { "name": "i", "description": "" } ], "access": "private", "tagname": "", "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 110, "description": "Sift down elements in binary tree", "itemtype": "method", "name": "_siftDown", "params": [ { "name": "i", "description": "" } ], "access": "private", "tagname": "", "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 146, "description": "Extracts a node from top of the heap and sift up", "itemtype": "method", "name": "extract", "return": { "description": "any The value of the extracted node." }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 169, "description": "Inserts an element in the heap by sifting it up", "itemtype": "method", "name": "insert", "params": [ { "name": "value", "description": "The value to insert." } ], "return": { "description": "void" }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 181, "description": "Peeks at the node from the top of the heap", "itemtype": "method", "name": "top", "return": { "description": "any The value of the node on the top." }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 195, "description": "Counts the number of elements in the heap", "itemtype": "method", "name": "count", "return": { "description": "number the number of elements in the heap." }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 205, "description": "Checks whether the heap is empty", "itemtype": "method", "name": "isEmpty", "return": { "description": "boolean whether the heap is empty." }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 215, "description": "Rewind iterator back to the start (no-op)", "itemtype": "method", "name": "rewind", "return": { "description": "void" }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 225, "description": "Return current node pointed by the iterator", "itemtype": "method", "name": "current", "return": { "description": "any The current node value." }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 235, "description": "Return current node index", "itemtype": "method", "name": "key", "return": { "description": "any The current node index." }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 245, "description": "Move to the next node", "itemtype": "method", "name": "next", "return": { "description": "void" }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 255, "description": "Move to previous entry", "itemtype": "method", "name": "prev", "return": { "description": "void" }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 265, "description": "Check whether the heap contains more nodes", "itemtype": "method", "name": "valid", "return": { "description": "boolean true if the heap contains any more nodes, false otherwise." }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 275, "description": "Compare elements in order to place them correctly in the heap while sifting up.", "itemtype": "method", "name": "compare", "params": [ { "name": "first", "description": "The value of the first node being compared." }, { "name": "second", "description": "The value of the second node being compared." } ], "return": { "description": "number Result of the comparison, positive integer if first is greater than second, 0 if they are equal, negative integer otherwise.\nHaving multiple elements with the same value in a Heap is not recommended. They will end up in an arbitrary relative position." }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 294, "description": "Visually display heap tree", "itemtype": "method", "name": "_displayNode", "params": [ { "name": "node", "description": "" }, { "name": "prefix", "description": "" }, { "name": "last", "description": "" } ], "return": { "description": "String" }, "access": "private", "tagname": "", "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 332, "description": "Serializes the heap to string", "itemtype": "method", "name": "toString", "return": { "description": "string The serialized string." }, "class": "Heap" }, { "file": "Datastructures/Heap.ts", "line": 343, "description": "Serializes the heap to array", "itemtype": "method", "name": "toArray", "return": { "description": "Array The serialized array." }, "class": "Heap" }, { "file": "Datastructures/PriorityQueue.ts", "line": 14, "description": "Adds an element to the queue", "itemtype": "method", "name": "enqueue", "params": [ { "name": "value", "description": "The value to enqueue." }, { "name": "priority", "description": "The priority of value." } ], "return": { "description": "void" }, "class": "PriorityQueue" }, { "file": "Datastructures/PriorityQueue.ts", "line": 26, "description": "Dequeues a node from the queue", "itemtype": "method", "name": "dequeue", "return": { "description": "any The value of the dequeued node." }, "class": "PriorityQueue" }, { "file": "Datastructures/PriorityQueue.ts", "line": 36, "description": "Peeks at the node from the top of the heap", "itemtype": "method", "name": "top", "return": { "description": "any The value of the node on the top." }, "class": "PriorityQueue" }, { "file": "Datastructures/PriorityQueue.ts", "line": 46, "description": "Compare elements in order to place them correctly in the heap while sifting up.", "itemtype": "method", "name": "compare", "params": [ { "name": "first", "description": "The value of the first node being compared." }, { "name": "second", "description": "The value of the second node being compared." } ], "return": { "description": "number Result of the comparison, positive integer if first is greater than second, 0 if they are equal, negative integer otherwise.\nHaving multiple elements with the same value in a Heap is not recommended. They will end up in an arbitrary relative position." }, "class": "PriorityQueue" }, { "file": "Datastructures/PriorityQueue.ts", "line": 73, "description": "Node value", "itemtype": "property", "name": "value", "type": "any", "class": "PriorityQueueNode" }, { "file": "Datastructures/PriorityQueue.ts", "line": 81, "description": "Node priority", "itemtype": "property", "name": "priority", "type": "any", "class": "PriorityQueueNode" }, { "file": "Datastructures/PriorityQueue.ts", "line": 89, "description": "Constructor", "itemtype": "method", "name": "constructor", "params": [ { "name": "value", "description": "" }, { "name": "priority", "description": "" } ], "class": "PriorityQueueNode" }, { "file": "Datastructures/PriorityQueue.ts", "line": 101, "description": "Serializes the node to string", "itemtype": "method", "name": "toString", "return": { "description": "string The serialized string." }, "class": "PriorityQueueNode" }, { "file": "Datastructures/Queue.ts", "line": 12, "description": "Adds an element to the queue", "itemtype": "method", "name": "enqueue", "params": [ { "name": "value", "description": "The value to enqueue." } ], "return": { "description": "void" }, "class": "Queue" }, { "file": "Datastructures/Queue.ts", "line": 23, "description": "Dequeues a node from the queue", "itemtype": "method", "name": "dequeue", "return": { "description": "any The value of the dequeued node." }, "class": "Queue" } ], "warnings": [ { "message": "unknown tag: interface", "line": " Datastructures/DoublyLinkedList.ts:316" }, { "message": "Missing item type\nDoublyLinkedList element", "line": " Datastructures/DoublyLinkedList.ts:316" } ] }