{"id":22213636,"url":"https://github.com/guillainbisimwa/javasript-dastructures-and-algorithms","last_synced_at":"2025-03-25T06:22:27.384Z","repository":{"id":45381299,"uuid":"437894628","full_name":"guillainbisimwa/JavaSript-dastructures-and-algorithms","owner":"guillainbisimwa","description":"A Practical Guide to Algorithms with JavaScript","archived":false,"fork":false,"pushed_at":"2023-01-19T17:38:21.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T05:42:46.627Z","etag":null,"topics":["algorithm","data-structure","data-structures","graph","hashtable","linked-list","sorting-algorithms","tree"],"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/guillainbisimwa.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}},"created_at":"2021-12-13T14:00:18.000Z","updated_at":"2023-03-06T07:33:04.000Z","dependencies_parsed_at":"2023-02-11T13:15:20.786Z","dependency_job_id":null,"html_url":"https://github.com/guillainbisimwa/JavaSript-dastructures-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/guillainbisimwa%2FJavaSript-dastructures-and-algorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guillainbisimwa%2FJavaSript-dastructures-and-algorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guillainbisimwa%2FJavaSript-dastructures-and-algorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guillainbisimwa%2FJavaSript-dastructures-and-algorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guillainbisimwa","download_url":"https://codeload.github.com/guillainbisimwa/JavaSript-dastructures-and-algorithms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245408997,"owners_count":20610436,"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":["algorithm","data-structure","data-structures","graph","hashtable","linked-list","sorting-algorithms","tree"],"created_at":"2024-12-02T21:10:28.000Z","updated_at":"2025-03-25T06:22:27.364Z","avatar_url":"https://github.com/guillainbisimwa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DATASTRUCTURE AND ALGORITHMS IN JAVASCRIPT\n\n## Implement a Stack data structure\n\nLIFO - Last in, first out\nCollection of elements with push and pop operations.\nNote that there is a natural order. Elements are removed in the reverse order of their addition.\n\n## Implement a Queue data structure\n\nFIFO - First in, first out\nCollection of elements with enqueue and dequeue operations.\nNote that there is a natural order. Elements are removed in the order of their addition.\n\n## Implement a LINKED LIST data structure\n\nComprised of nodes that represent a sequence.\nEach node is composed of data and a reference/link to the next node.\n\n## Implement a TREE data structure\n\nA tree has a root node.\nThe root node has 0 or more children.\nEach child node has 0 or more children.\n(each node in the tree can be seen as a subtree)\n\n## Implement a BINARY SEARCH TREES data structure\n\nA binary search tree is a tree with the additional constraints:\n\n- Each node has only two child nodes (node.left and node.right)\n- All the values in the left subtree of a node are less than or equal to the value of the node\n- All the values in the right subtree of a node are greater than the value of the node\n\n## Implement a Graph data structure\n\nStores nodes (represented by any primitive value) and the neighbors for each node. This implementation represents a graph as an [adjacency list](https://en.wikipedia.org/wiki/Adjacency_list).\n\n## Implement a HASH TABLE data structure\n\nCollection of `key-value` pairs.\nMap keys to values for efficient lookup.\nUse an array as the underlying data structure.\nHash table should have a size - this will be used by the hashing function to determine what index to map the key to.\nA hashing function is used to map the key to an integer, which is the index that the value is to be stored at.\nSince our hashing function might map multiple keys to the same integer, we have to deal with collisions by creating buckets at each index of the storage array. These buckets can be arrays or linked lists.\n\n## Recursion\n\nThe process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called as recursive function. Using recursive algorithm, certain problems can be solved quite easily.\n\n## Elementary [Sorting](https://visualgo.net/en/sorting)\n\n### Bubble SORT\n\nIterate over array, comparing adjacent items and swap if in incorrect order. Largest elements bubble to the end of the array\n\n### Selection SORT\n\nIterate over array and grow a sorted array behind current element.\n\nFor each position, find the smallest element in unsorted subarray starting at that position, and swap elements so that smallest element is at the beginning of unsorted subarray.\n\n### Insertion SORT\n\nIterate over array and grow a sorted array behind current element.\n\nFor each position, compare value of element with previous elements and swap positions if previous element is larger.\n\n### Merge SORT\n\nMerge sort employs a divide and conquer strategy - merge two sorted subarrays into one sorted array.\n\nRecursive top-down approach:\nRecursively break down array into two subarrays and sort them recursively. Subarrays are broken down until they have only 1 element (implying they are sorted).\n\nIterative bottom-up approach:\nSplit array into sublists of size 1, merge adjacent sublists into sorted lists, repeat until no more sublists.\n\n### Quick SORT\n\nLike merge sort, quick sort employs a divide and conquer strategy.\n\nIt has a partitioning step, in which you pick an element (called a pivot) and partition the array so that all smaller elements come before pivot and all larger elements come after. The pivot will be in its final position. Recursively apply this to the subarray of smaller elements and the subarray of larger elements.\n\n## Author\n\n👤 **Guillain Bisimwa**\n\n- Github : [@guillainbisimwa](https://github.com/guillainbisimwa)\n- Twitter : [@gullain_bisimwa](https://twitter.com/gullain_bisimwa)\n- Linkedin : [guillain-bisimwa](https://www.linkedin.com/in/guillain-bisimwa-8a8b7a7b/)\n\n## 🤝 Contributing\n\nContributions, issues, and feature requests are welcome!\n\nFeel free to check the [issues page](https://github.com/guillainbisimwa/JavaSript-dastructures-and-algorithms/issues).\n\n## Acknowledgments\n\n- [Frontendmasters](https://frontendmasters.com/courses/data-structures-algorithms/)\n- [Quokka](https://quokkajs.com/?referrer=qsp) for highlight all logged values in output pane and vscode IDE\n\n## Show your support\n\nGive a ⭐️ if you like this project!\n\n## 📝 License\n\nThis project is [MIT](lic.url) licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguillainbisimwa%2Fjavasript-dastructures-and-algorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguillainbisimwa%2Fjavasript-dastructures-and-algorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguillainbisimwa%2Fjavasript-dastructures-and-algorithms/lists"}