{"id":19339872,"url":"https://github.com/harrisonhoward/data-structures-and-algorithms","last_synced_at":"2025-04-23T02:31:01.329Z","repository":{"id":137407064,"uuid":"385467702","full_name":"harrisonhoward/data-structures-and-algorithms","owner":"harrisonhoward","description":"My implementation of common data structures and algorithms in JavaScript","archived":true,"fork":false,"pushed_at":"2021-08-09T06:42:11.000Z","size":190,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T08:28:15.669Z","etag":null,"topics":["algorithms","algorithms-and-data-structures","data-structures","data-structures-and-algorithms"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harrisonhoward.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-13T03:52:46.000Z","updated_at":"2024-04-16T11:13:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"3400698e-281d-4261-94d8-95181d0004b8","html_url":"https://github.com/harrisonhoward/data-structures-and-algorithms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrisonhoward%2Fdata-structures-and-algorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrisonhoward%2Fdata-structures-and-algorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrisonhoward%2Fdata-structures-and-algorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrisonhoward%2Fdata-structures-and-algorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harrisonhoward","download_url":"https://codeload.github.com/harrisonhoward/data-structures-and-algorithms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250357581,"owners_count":21417310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","algorithms-and-data-structures","data-structures","data-structures-and-algorithms"],"created_at":"2024-11-10T03:24:10.386Z","updated_at":"2025-04-23T02:31:01.317Z","avatar_url":"https://github.com/harrisonhoward.png","language":"JavaScript","readme":"# Data Structures and Algorithms\n\nThis project was not designed with the intent that non of the models, sorting algorithms and data structures would be used. This project was completed with the sole intent of broading my own knowledge and assisting others who required help with building similar data structures and algorithms.\n\n## Testing\n\n    1. Change to the root directory of the project\n    2. Run \"npm test\" (Will include a coverage folder)\n\n## What is included\n\n### **[Models](https://github.com/Forbidden-Duck/data-structures-and-algorithms/tree/master/src/models)**\n\n-   [SingleNode](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/models/SingleNode.js)\n    \u003e `constructor(data: any)`\\\n    \u003e `.data (property)` _any_ type\\\n    \u003e `.next (property)` _SingleNode_ type\\\n    \u003e `.compareInstance(a: SingleNode, b: SingleNode) (static method)` =\u003e _boolean_ type\n-   [DoubleNode](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/models/DoubleNode.js)\n    \u003e `constructor(data: any)`\\\n    \u003e `.data (property)` _any_ type\\\n    \u003e `.next (property)` _DoubleNode_ type\\\n    \u003e `.previous (property)` _DoubleNode_ type\\\n    \u003e `.compareInstance(a: DoubleNode, b: DoubleNode) (static method)` =\u003e _boolean_ type\n-   [TreeNode](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/models/TreeNode.js)\n    \u003e `constructor(key: number, data: any)`\\\n    \u003e `.key (property)` _number_ type\\\n    \u003e `.data (property)` _any_ type\\\n    \u003e `.left (property)` _TreeNode_ type\\\n    \u003e `.right (property)` _TreeNode_ type\\\n    \u003e `.parent (property)` _TreeNode_ type\\\n    \u003e `.compareInstance(a: TreeNode, b: TreeNode) (static method)` =\u003e _boolean_ type\n-   [HeapNode](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/models/HeapNode.js)\n    \u003e `constructor(key: number, data: any)`\\\n    \u003e `.key (property)` _number_ type\\\n    \u003e `.data (property)` _any_ type\\\n    \u003e `.compareInstance(a: HeapNode, b: HeapNode) (static method)` =\u003e _boolean_ type\n-   [GraphNode](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/models/GraphNode.js)\n    \u003e `constructor(key: number, data: any)`\\\n    \u003e `.key (property)` _number_ type\\\n    \u003e `.data (property)` _any_ type\\\n    \u003e `.getEdge(node: GraphNode) (method)` =\u003e _GraphNode_ type\\\n    \u003e `.addEdge(node: GraphNode) (method)` =\u003e _GraphNode_ type\\\n    \u003e `.deleteEdge(key: number) (method)` =\u003e _void_ type\\\n    \u003e `.compareInstance(a: GraphNode, b: GraphNode) (static method)` =\u003e _boolean_ type\n\n### **[Structures](https://github.com/Forbidden-Duck/data-structures-and-algorithms/tree/master/src/structures)**\n\n-   [SinglyLinkedList](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/SinglyLinkedList.js)\n    \u003e `.head (property)` _SingleNode_ type\\\n    \u003e `.tail (property` _SingleNode_ type\\\n    \u003e `.prepend(node: SingleNode) (method)` =\u003e _SingleNode_ type\\\n    \u003e `.append(node: SingleNode) (method)` =\u003e _SingleNode_ type\\\n    \u003e `.insertBefore(node: SingleNode, nodeBefore: SingleNode) (method)` =\u003e _SingleNode_ type\\\n    \u003e `.insertAfter(node: SingleNode, nodeAfter: nodeAfter) (method)` =\u003e _SingleNode_ type\\\n    \u003e `.delete(node: SingleNode) (method)` =\u003e _void_ type\\\n    \u003e `.deleteBefore(node: SingleNode) (method)` =\u003e _void_ type\\\n    \u003e `.deleteAfter(node: SingleNode) (method)` =\u003e _void_ type\\\n    \u003e `.clear() (method)` =\u003e _void_ type\\\n    \u003e `.get(index: number) (method)` =\u003e _SingleNode_ type\\\n    \u003e `.find(callbackFn: function) (method)` =\u003e _SingleNode_ type\\\n    \u003e `.getNodeBefore(node: SingleNode) (method)` =\u003e _SingleNode_ type\\\n    \u003e `.forEach(callbackFn: function, thisArg?: any) (method)` =\u003e _void_ type\\\n    \u003e `.filter(callbackFn: function, thisArg?: any) (method)` =\u003e _void_ type\\\n    \u003e `.clone() (method)` =\u003e _SinglyLinkedList_ type\\\n    \u003e `.size (property)` _number_ type\\\n    \u003e `.toArray() (method)` =\u003e _SingleNode[]_ type\\\n    \u003e `.toString() (method)` =\u003e _string_ type\\\n    \u003e `.toStringReverse() (method)` =\u003e _string_ type\n-   [DoublyLinkedList](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/DoublyLinkedList.js)\n    \u003e `.head (property)` _DoubleNode_ type\\\n    \u003e `.tail (property` _DoubleNode_ type\\\n    \u003e `.prepend(node: DoubleNode) (method)` =\u003e _DoubleNode_ type\\\n    \u003e `.append(node: DoubleNode) (method)` =\u003e _DoubleNode_ type\\\n    \u003e `.insertBefore(node: DoubleNode, nodeBefore: DoubleNode) (method)` =\u003e _DoubleNode_ type\\\n    \u003e `.insertAfter(node: DoubleNode, nodeAfter: nodeAfter) (method)` =\u003e _DoubleNode_ type\\\n    \u003e `.delete(node: DoubleNode) (method)` =\u003e _void_ type\\\n    \u003e `.deleteBefore(node: DoubleNode) (method)` =\u003e _void_ type\\\n    \u003e `.deleteAfter(node: DoubleNode) (method)` =\u003e _void_ type\\\n    \u003e `.clear() (method)` =\u003e _void_ type\\\n    \u003e `.get(index: number) (method)` =\u003e _DoubleNode_ type\\\n    \u003e `.find(callbackFn: function) (method)` =\u003e _DoubleNode_ type\\\n    \u003e `.getNodeBefore(node: DoubleNode) (method)` =\u003e _DoubleNode_ type\\\n    \u003e `.forEach(callbackFn: function, thisArg?: any) (method)` =\u003e _void_ type\\\n    \u003e `.filter(callbackFn: function, thisArg?: any) (method)` =\u003e _void_ type\\\n    \u003e `.clone() (method)` =\u003e _SinglyLinkedList_ type\\\n    \u003e `.size (property)` _number_ type\\\n    \u003e `.toArray() (method)` =\u003e _DoubleNode[]_ type\\\n    \u003e `.toString() (method)` =\u003e _string_ type\\\n    \u003e `.toStringReverse() (method)` =\u003e _string_ type\n-   [Queue](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/Queue.js)\n    \u003e `.peek (property)` _any_ type\\\n    \u003e `.enqueue(value: any) (method)` =\u003e _void_ type\\\n    \u003e `.dequeue() (method)` =\u003e _any_ type\\\n    \u003e `.isEmpty() (method)` =\u003e _boolean_ type\\\n    \u003e `.clear() (method)` =\u003e _void_ type\\\n    \u003e `.clone() (method)` =\u003e _Queue_ type\\\n    \u003e `.size (property)` _number_ type\\\n    \u003e `.toArray() (method)` =\u003e _any[]_ type\\\n    \u003e `.toString() (method)` =\u003e _string_ type\n-   [Stack](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/Stack.js)\n    \u003e `.peek (property)` _any_ type\\\n    \u003e `.push(value: any) (method)` =\u003e _void_ type\\\n    \u003e `.pop() (method)` =\u003e _any_ type\\\n    \u003e `.isEmpty() (method)` =\u003e _boolean_ type\\\n    \u003e `.clear() (method)` =\u003e _void_ type\\\n    \u003e `.clone() (method)` =\u003e _Stack_ type\\\n    \u003e `.size (property)` _number_ type\\\n    \u003e `.toArray() (method)` =\u003e _any[]_ type\\\n    \u003e `.toString() (method)` =\u003e _string_ type\n-   [BinaryTree](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/BinaryTree.js)\n    \u003e `.root (property)` _TreeNode_ type\\\n    \u003e `.insert(node: TreeNode) (method)` =\u003e _TreeNode_ type\\\n    \u003e `.delete(node: TreeNode) (method)` =\u003e _void_ type\\\n    \u003e `.clear() (method)` =\u003e _void_ type\\\n    \u003e `.get(key: number) (method)` =\u003e _TreeNode_ type\\\n    \u003e `.find(callbackFn: function) (method)` =\u003e _TreeNode_ type\\\n    \u003e `.min() (method)` =\u003e _TreeNode_ type\\\n    \u003e `.max() (method)` =\u003e _TreeNode_ type\\\n    \u003e `.lowerBound(key: number) (method)` =\u003e _TreeNode_ type\\\n    \u003e `.upperBound(key: number) (method)` =\u003e _TreeNode_ type\\\n    \u003e `.forEach(callbackFn: function, startNode?: TreeNode, thisArg?: any) (method)` =\u003e _void_ type\\\n    \u003e `.clone() (method)` =\u003e _BinaryTree_ type\\\n    \u003e `.size (property)` _number_ type\\\n    \u003e `.toPreOrder() (method)` =\u003e _TreeNode[]_ type\\\n    \u003e `.toInOrder() (method)` =\u003e _TreeNode[]_ type\\\n    \u003e `.toPostOrder() (method)` =\u003e _TreeNode[]_ type\n-   [HashMap](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/HashMap.js)\n    \u003e `.keys (property)` _string[]_ type\\\n    \u003e `.hashes (property)` _number[]_ type\\\n    \u003e `.values (property)` _any[]_ type\\\n    \u003e `.hash(key: string) (method)` =\u003e _number_ type\\\n    \u003e `.has(key: string) (method)` =\u003e _boolean_ type\\\n    \u003e `.get(key: string) (method)` =\u003e _any_ type\\\n    \u003e `.set(key: string, value: any) (method)` =\u003e _any_ type\\\n    \u003e `.delete(key: string) (method)` =\u003e _void_ type\n-   [Heap](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/Heap.js)\n    \u003e `.root (property)` _HeapNode_ type\\\n    \u003e `.insert(node: HeapNode) (method)` =\u003e _HeapNode_ type\\\n    \u003e `.delete(node: HeapNode) (method)` =\u003e _void_ type\\\n    \u003e `.clear() (method)` =\u003e _void_ type\\\n    \u003e `.get(index: number) (method)` =\u003e _HeapNode_ type\\\n    \u003e `.find(callbackFn: function, thisArg?: any) (method)` =\u003e _HeapNode_ type\\\n    \u003e `.findIndex(callbackFn: function, thisArg?: any) (method)` =\u003e _number_ type\\\n    \u003e `.forEach(callbackFn: function, thisArg?: any) (method)` =\u003e _void_ type\\\n    \u003e `.clone(HeapType: MinHeap | MaxHeap) (method)` =\u003e _MinHeap | MaxHeap_ type\n-   [MinHeap](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/MinHeap.js) extends [Heap](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/Heap.js)\n    \u003e `.compareKeys(parentKey: number, childKey: number) (method)` =\u003e _boolean_ type\\\n    \u003e `.clone() (method)` =\u003e _MinHeap_ type\n-   [MaxHeap](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/MaxHeap.js) extends [Heap](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/Heap.js)\n    \u003e `.compareKeys(parentKey: number, childKey: number) (method)` =\u003e _boolean_ type\\\n    \u003e `.clone() (method)` =\u003e _MinHeap_ type\n-   [Graph](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/structures/Graph.js)\n    \u003e `constructor(egdeDirection?: \"directed\" | \"undirected\")`\\\n    \u003e `.isDirected (property)` _boolean_ type\\\n    \u003e `.hasVertex(key: number) (method)` =\u003e _boolean_ type\\\n    \u003e `.addVertex(node: GraphNode) (method)` =\u003e _GraphNode_ type\\\n    \u003e `.deleteVertex(key: number) (method)` =\u003e _void_ type\\\n    \u003e `.hasEdge(srcKey: number, destKey: number) (method)` =\u003e _boolean_ type\\\n    \u003e `.addEdge(source: GraphNode, dest: GraphNode) (method)` =\u003e _{source: GraphNode, destination: GraphNode}_ type\\\n    \u003e `.deleteEdge(srcKey: number, destKey: number) (method)` =\u003e _void_ type\\\n    \u003e `.clear() (method)` =\u003e _void_ type\\\n    \u003e `.clone() (method)` =\u003e _Graph_ type\\\n    \u003e `.verticesSize (property)` _number_ type\\\n    \u003e `.size (property)` _number_ type\\\n    \u003e `.toBFS() (method)` =\u003e _GraphNode[]_ type\\\n    \u003e `.toDFS() (method)` =\u003e _GraphNode[]_ type\n\n### **[Algorithms](https://github.com/Forbidden-Duck/data-structures-and-algorithms/tree/master/src/sorting)**\n\n-   [MergeSort](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/sorting/MergeSort.js)\n    \u003e `(originalArr: any[], classType?: class)` =\u003e _any[]_ type\n-   [BubbleSort](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/sorting/BubbleSort.js)\n    \u003e `(originalArr: any[], classType?: class)` =\u003e _any[]_ type\n-   [QuickSort](https://github.com/Forbidden-Duck/data-structures-and-algorithms/blob/master/src/sorting/QuickSort.js)\n    \u003e `(originalArr: any[], classType?: class)` =\u003e _any[]_ type\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrisonhoward%2Fdata-structures-and-algorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharrisonhoward%2Fdata-structures-and-algorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrisonhoward%2Fdata-structures-and-algorithms/lists"}