{"id":25419415,"url":"https://github.com/tyhil/linked-list","last_synced_at":"2025-05-11T19:09:42.076Z","repository":{"id":158382485,"uuid":"329445090","full_name":"TyHil/linked-list","owner":"TyHil","description":"A singly linked list C++ library","archived":false,"fork":false,"pushed_at":"2023-05-04T17:16:33.000Z","size":49,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T18:40:06.402Z","etag":null,"topics":["cpp","linked-list","pointer"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TyHil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-01-13T22:19:11.000Z","updated_at":"2024-06-10T09:34:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"c51f5565-9857-4388-a320-f47c64a06dcd","html_url":"https://github.com/TyHil/linked-list","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/TyHil%2Flinked-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TyHil%2Flinked-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TyHil%2Flinked-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TyHil%2Flinked-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TyHil","download_url":"https://codeload.github.com/TyHil/linked-list/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166475,"owners_count":21864469,"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":["cpp","linked-list","pointer"],"created_at":"2025-02-16T18:39:32.046Z","updated_at":"2025-05-08T23:51:32.167Z","avatar_url":"https://github.com/TyHil.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# linked-list\n[![Run on Repl.it](https://repl.it/badge/github/TyHil/linked-list)](https://repl.it/github/TyHil/linked-list)\n## Description\nA singly linked list C++ library  \n## Documentation\nSee `test.cpp` for examples.  \n`template \u003ctypename T\u003e` partially specialized for `T` or `T *`.  \n### Initialization examples\n`LinkedList\u003cint\u003e list = LinkedList\u003cint\u003e();`  \n`LinkedList\u003cCard *\u003e list = LinkedList\u003cCard *\u003e();`  \n### Constructor\n`LinkedList()`  \nCreate a new `LinkedList` with no data.\n### Copy Constructor\n`LinkedList(LinkedList const \u0026source)`  \nCreate a new `LinkedList` with copy of data from source.  \nParameters:  \n\u0026nbsp;\u0026nbsp;`LinkedList const \u0026source`: list to copy data from.  \n### Destructor\n`~LinkedList()`\nCalls `clear()`.  \n### Clear\n`void clear()`  \nClears and deletes all nodes and data.  \n### Add\n`void add(T data)`  \n`void add(T *data)`  \nAdds a new node with specified data to the end of the linked list.  \nParameters:  \n\u0026nbsp;\u0026nbsp;`T data` or `T *data`: primitive data or pointer to new data to be stored  \n### Size\n`int size()`  \nReturns the number of nodes.  \nReturns:  \n\u0026nbsp;\u0026nbsp;`int`: the size of the linked list.  \n### Set\n`void set(const int index, T data)`  \n`void set(const int index, T *data)`  \nReplaces the data of the node at the specified index with new data.  \nParameters:  \n\u0026nbsp;\u0026nbsp;`const int index`: index of desired node  \n\u0026nbsp;\u0026nbsp;`T data` or `T *data`: primitive data or pointer to new data to be stored  \n### Insert\n`void insert(const int index, T data)`  \n`void insert(const int index, T *data)`  \nInserts a new node and new data before the specified index.  \nParameters:  \n\u0026nbsp;\u0026nbsp;`const int index`: index of node to be after new node  \n\u0026nbsp;\u0026nbsp;`T data` or `T *data`: primitive data or pointer to new data to be stored  \n### Remove\n`void remove(const int index)`  \nRemoves the node and data at the specified index.  \nParameters:  \n\u0026nbsp;\u0026nbsp;`const int index`: index of node to be deleted  \n### Empty\n`bool empty()`  \nReturns true if the linked list has no elements in it.  \nReturns:  \n\u0026nbsp;\u0026nbsp;`bool`: whether the linked list is empty  \n### Swap\n`void swap(const int index1, const int index2)`  \nSwitches the data of the nodes at the specified indexes.  \nParameters:  \n\u0026nbsp;\u0026nbsp;`const int index1`: index of the first specified node  \n\u0026nbsp;\u0026nbsp;`const int index2`: index of the second specified node  \n### Sub List\n`LinkedList\u003cT\u003e * subList(const int start, const int length)`  \nCreates and returns a new list containing data from a sub-range of the linked list.  \nParameters:  \n\u0026nbsp;\u0026nbsp;`const int start`: starting index of the sub-range  \n\u0026nbsp;\u0026nbsp;`const int length`: length of the sub-range (start + length is not included in the new linked list)  \nReturns:  \n\u0026nbsp;\u0026nbsp;`LinkedList *`: a pointer to the new linked list  \n### Overload `[]`\n`T operator[](const int index)`  \n`T *operator[](const int index)`  \nAccess data at the given index.  \nParameters:  \n\u0026nbsp;\u0026nbsp;`const int index`: index of desired node  \nReturns:  \n\u0026nbsp;\u0026nbsp;`T ` or `T *`: primitive data or pointer to data  \n### Overload `\u003c\u003c`\n`std::ostream \u0026operator\u003c\u003c(std::ostream \u0026os, const LinkedList\u003cT\u003e \u0026list)`  \n`std::ostream \u0026operator\u003c\u003c(std::ostream \u0026os, const LinkedList\u003cT *\u003e \u0026list)`  \nPrint the data in the list to the ostream. The class in a pointer list `T *` must also overload the `\u003c\u003c` operator.  \nParameters:  \n\u0026nbsp;\u0026nbsp;`std::ostream \u0026os`: ostream data being added to  \n\u0026nbsp;\u0026nbsp;`const LinkedList\u003cT\u003e \u0026list` or `const LinkedList\u003cT *\u003e \u0026list`: list to be printed  \nReturns: `std::ostream \u0026`: ostream with added data  \n## License\nGPL-3.0 License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyhil%2Flinked-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyhil%2Flinked-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyhil%2Flinked-list/lists"}