{"id":15047480,"url":"https://github.com/redjasm/cpp-dynamicarrays","last_synced_at":"2025-07-03T14:07:55.102Z","repository":{"id":208422065,"uuid":"721591906","full_name":"redjasm/cpp-dynamicarrays","owner":"redjasm","description":"Dynamic arrays (array lists) and doubly linked lists in c++","archived":false,"fork":false,"pushed_at":"2023-11-21T11:36:13.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T20:21:24.426Z","etag":null,"topics":["cpp14","makefile"],"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/redjasm.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}},"created_at":"2023-11-21T11:30:54.000Z","updated_at":"2023-11-21T11:42:09.000Z","dependencies_parsed_at":"2023-11-21T12:49:23.649Z","dependency_job_id":null,"html_url":"https://github.com/redjasm/cpp-dynamicarrays","commit_stats":null,"previous_names":["josephayman/cpp-dynamicarrays","redjasm/cpp-dynamicarrays"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/redjasm/cpp-dynamicarrays","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redjasm%2Fcpp-dynamicarrays","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redjasm%2Fcpp-dynamicarrays/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redjasm%2Fcpp-dynamicarrays/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redjasm%2Fcpp-dynamicarrays/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redjasm","download_url":"https://codeload.github.com/redjasm/cpp-dynamicarrays/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redjasm%2Fcpp-dynamicarrays/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263339940,"owners_count":23451518,"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":["cpp14","makefile"],"created_at":"2024-09-24T20:58:57.887Z","updated_at":"2025-07-03T14:07:55.069Z","avatar_url":"https://github.com/redjasm.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# H23_project2_josefam\nThis a school project where I developed various data structures in C++ (C++14 standard), focusing on dynamic arrays (array lists) and doubly linked lists. The project involved extending these structures, analyzing their behavior and efficiency, and comparing their performance.\n\n## Get started\nStart by cloning the repository:\n```bash\ngit clone https://github.com/josephayman/cpp-dynamicarrays\ncd cpp-dynamicarrays\n```\n\n## How to Compile and run\nCompile and run the program with the following commands:\n```bash\nclang++ -std=c++14 test_array_list.cpp -o test_array_list\n```\nAdding the **-std=c++14** flag is **necessary** because I newer features and syntax from C++14.\n\nAnd then execute the program with ./test_array_list\n\n## List of tasks completed\n\nAll of the tasks in the project description has been completed. Compiled, run and tested on Mac OS with clang++ 14.0.0.\n- [x] Exercise 1\n- [x] Exercise 2\n- [x] Exercise 3\n- [x] Exercise 4\n\n\n## Exercise 3 a)\n\n| Operation                     | ArrayList        | LinkedList        |\n|-------------------------------|------------------|-------------------|\n| Get element \\( i \\) by index  | \\( O(1) \\)       | \\( O(n) \\)        |\n| Insert at front               | \\( O(n) \\)       | \\( O(1) \\)        |\n| Insert at back (append)       | \\( O(1) \\) avg*  | \\( O(1) \\)        |\n| Insert into middle            | \\( O(n) \\)       | \\( O(n) \\)        |\n| Remove element from front     | \\( O(n) \\)       | \\( O(1) \\)        |\n| Remove element from back      | \\( O(1) \\) avg*  | \\( O(1) \\)        |\n| Remove element from middle    | \\( O(n) \\)       | \\( O(n) \\)        |\n| Print                         | \\( O(n) \\)       | \\( O(n) \\)        |\n\n\\* And \\( O(n) \\) if a resize/shrink is required.\n\nThe reasoning here is the following:\n\n* Get element by index: ArrayList has \\( O(1) \\) because it is a direct access data structure, while LinkedList has \\( O(n) \\) because it has to traverse the list from the beginning to the index.\n* Insert at front: ArrayList has \\( O(n) \\) because it has to shift all elements one step to the right, while LinkedList has \\( O(1) \\) because it only has to change the pointers of the first element.\n* Insert at back: ArrayList has \\( O(1) \\) because it has a pointer to the last element, while LinkedList has \\( O(1) \\) because it only has to change the pointers of the last element.\n* Insert into middle: ArrayList has \\( O(n) \\) because it has to shift all elements one step to the right, while LinkedList has \\( O(n) \\) because it has to traverse the list from the beginning to the index.\n* Remove element from front: ArrayList has \\( O(n) \\) because it has to shift all elements one step to the left, while LinkedList has \\( O(1) \\) because it only has to change the pointers of the first element.\n* Remove element from back: ArrayList has \\( O(1) \\) because it has a pointer to the last element, while LinkedList has \\( O(1) \\) because it only has to change the pointers of the last element (The tail).\n* Remove element from middle: ArrayList has \\( O(n) \\) because it has to shift all elements one step to the left, while LinkedList has \\( O(n) \\) because it has to traverse the list from the beginning to the index.\n* Print: Both ArrayList and LinkedList has \\( O(n) \\) because they have to traverse the list from the beginning to the end and print each element.\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredjasm%2Fcpp-dynamicarrays","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredjasm%2Fcpp-dynamicarrays","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredjasm%2Fcpp-dynamicarrays/lists"}