{"id":24502692,"url":"https://github.com/th92rodr/data-structures-and-algorithms","last_synced_at":"2025-03-15T08:13:48.003Z","repository":{"id":119267435,"uuid":"232691382","full_name":"th92rodr/data-structures-and-algorithms","owner":"th92rodr","description":"Data Structures and Common Algorithms Implementations.","archived":false,"fork":false,"pushed_at":"2021-02-20T20:13:36.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-21T23:13:13.253Z","etag":null,"topics":["algorithms","data-structures"],"latest_commit_sha":null,"homepage":"","language":"C","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/th92rodr.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":"2020-01-09T01:01:42.000Z","updated_at":"2023-01-28T17:05:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"85583b08-dcf7-48cc-a0ba-27087a00d31c","html_url":"https://github.com/th92rodr/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/th92rodr%2Fdata-structures-and-algorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/th92rodr%2Fdata-structures-and-algorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/th92rodr%2Fdata-structures-and-algorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/th92rodr%2Fdata-structures-and-algorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/th92rodr","download_url":"https://codeload.github.com/th92rodr/data-structures-and-algorithms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243701466,"owners_count":20333631,"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","data-structures"],"created_at":"2025-01-21T23:13:20.022Z","updated_at":"2025-03-15T08:13:47.978Z","avatar_url":"https://github.com/th92rodr.png","language":"C","readme":"# Data Structures\n\nA data structure is a particular way of organizing and storing data in a computer so that it can be accessed and modified efficiently. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.\n\n- [Linked List / Doubly Linked List](https://github.com/th92rodr/data-structures-and-algorithms/tree/master/data-structures/linked-list)\n- [Stack](https://github.com/th92rodr/data-structures-and-algorithms/tree/master/data-structures/stack)\n- [Queue](https://github.com/th92rodr/data-structures-and-algorithms/tree/master/data-structures/queue)\n- [Hash Table](https://github.com/th92rodr/data-structures-and-algorithms/tree/master/data-structures/hash-table)\n- [Graph](https://github.com/th92rodr/data-structures-and-algorithms/tree/master/data-structures/graph)\n- [Binary Search Tree](https://github.com/th92rodr/data-structures-and-algorithms/tree/master/data-structures/binary-search-tree)\n- [Trie](https://github.com/th92rodr/data-structures-and-algorithms/tree/master/data-structures/trie)\n- Heap\n\n## Data Structure Operations Big-O Complexity\n\n| Data Structure     |  Access  |  Search  | Insertion | Deletion |\n| ------------------ | :------: | :------: | :-------: | :------: |\n| Array              |   O(1)   |   O(n)   |   O(n)    |   O(n)   |\n| Stack              |   O(n)   |   O(n)   |   O(1)    |   O(1)   |\n| Queue              |   O(n)   |   O(n)   |   O(1)    |   O(1)   |\n| Linked List        |   O(n)   |   O(n)   |   O(1)    |   O(1)   |\n| Doubly Linked List |   O(n)   |   O(n)   |   O(1)    |   O(1)   |\n| Hash Table         |    -     |   O(1)   |   O(1)    |   O(1)   |\n| Binary Search Tree | O(log n) | O(log n) | O(log n)  | O(log n) |\n| B-Tree             | O(log n) | O(log n) | O(log n)  | O(log n) |\n| Red-Black Tree     | O(log n) | O(log n) | O(log n)  | O(log n) |\n| AVL Tree           | O(log n) | O(log n) | O(log n)  | O(log n) |\n\n---\n\n# Algorithms\n\n- [Tower of Hanoi Problem](#tower-of-hanoi-problem)\n- [Recursive Staircase](#recursive-staircase)\n- [First Recurring Character](#first-recurring-character)\n- [Conflicting Appointments](#conflicting-appointments)\n- [Dictionary Implementation](#dictionary-implementation)\n\n## Tower of Hanoi Problem\n\n[Solution \\o/](https://github.com/th92rodr/data-structures-and-algorithms/blob/master/algorithms/tower-of-hanoi.py)\n\nThe Tower of Hanoi (also called the Tower of Brahma or Lucas' Tower and sometimes pluralized as Towers) is a mathematical game or puzzle. It consists of three rods and a number of disks of different sizes, which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a conical shape.\n\nThe objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules:\n\n- Only one disk can be moved at a time.\n- Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack or on an empty rod.\n- No larger disk may be placed on top of a smaller disk.\n\nWith `3 disks`, the puzzle can be solved in `7 moves`. The minimal number of moves required to solve a Tower of Hanoi puzzle is `2^n − 1`, where `n` is the number of disks.\n\n![Alt Text](https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/Iterative_algorithm_solving_a_6_disks_Tower_of_Hanoi.gif/220px-Iterative_algorithm_solving_a_6_disks_Tower_of_Hanoi.gif)\n\n### References\n\n- [Wikipedia](https://en.wikipedia.org/wiki/Tower_of_Hanoi)\n- [HackerEarth](https://www.hackerearth.com/blog/developers/tower-hanoi-recursion-game-algorithm-explained)\n\n---\n\n## Recursive Staircase\n\n[Solution \\o/](https://github.com/th92rodr/data-structures-and-algorithms/blob/master/algorithms/recursive-staircase.py)\n\nThere are `n` stairs, a person standing at the bottom wants to reach the top. The person can climb either `1` or `2` stairs at a time. Count the number of ways, the person can reach the top.\n\nIn a second version of this problem is passed a set with all the possible stairs climb the person can climb at a time, for example: `[1, 3, 5]` the person can climb `1` or `3` or `5` stairs at a time.\n\n### References\n\n- [GeeksForGeeks](https://www.geeksforgeeks.org/count-ways-reach-nth-stair/)\n- [Youtube](https://www.youtube.com/watch?v=5o-kdjv7FD0\u0026list=PL7FWvzvL5ADKYeWwxL96btxTmsd3asDb2\u0026index=5\u0026t=0s)\n\n---\n\n## First Recurring Character\n\n[Solution \\o/](https://github.com/th92rodr/data-structures-and-algorithms/blob/master/algorithms/first-recurring-character.py)\n\nFind the first recurring character in a given string.\n\n- [GeeksForGeeks](https://www.geeksforgeeks.org/find-the-first-repeated-character-in-a-string/)\n- [Youtube](https://www.youtube.com/watch?v=GJdiM-muYqc\u0026list=PL7FWvzvL5ADKYeWwxL96btxTmsd3asDb2\u0026index=4\u0026t=0s)\n\n---\n\n## Conflicting Appointments\n\n[Solution \\o/](https://github.com/th92rodr/data-structures-and-algorithms/blob/master/algorithms/find-conflicting-appointments.py)\n\nGiven `n` appointments, find all the conflicting ones.\n\nExamples:\n\n```\nInput - Appointments:\n[ 10 to 11 ]\n[ 8 to 9 ]\n[ 12 to 13 ]\n[ 12.2 to 12.5 ]\n[ 8.5 to 9.5 ]\n[ 2 to 4 ]\n[ 10.5 to 12.5 ]\n[ 3.5 to 8.5 ]\n\nOutput - Conflicting appointments:\n[ 12.2 to 12.5 ] with [ 12 to 13 ]\n[ 8.5 to 9.5 ] with [ 8 to 9 ]\n[ 10.5 to 12.5 ] with [ 10 to 11 ]\n[ 10.5 to 12.5 ] with [ 12 to 13 ]\n[ 3.5 to 8.5 ] with [ 8 to 9 ]\n[ 3.5 to 8.5 ] with [ 2 to 4 ]\n```\n\n### References\n\n- [GeeksForGeeks](https://www.geeksforgeeks.org/given-n-appointments-find-conflicting-appointments/)\n\n---\n\n## Dictionary Implementation\n\n[Solution \\o/](https://github.com/th92rodr//data-structures-and-algorithms/blob/master/algorithms/dictionary-implementation.py)\n\nImplement a dictionary using a `Trie` such that if the input is a string representing a word, the program prints its meaning from the prebuilt dictionary.\n\n### References\n\n- [GeeksForGeeks](https://www.geeksforgeeks.org/implement-a-dictionary-using-trie/)\n\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fth92rodr%2Fdata-structures-and-algorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fth92rodr%2Fdata-structures-and-algorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fth92rodr%2Fdata-structures-and-algorithms/lists"}