{"id":25171431,"url":"https://github.com/basemax/onewaylinkedlistcpp","last_synced_at":"2026-06-17T21:31:28.383Z","repository":{"id":151535491,"uuid":"570877345","full_name":"BaseMax/OneWayLinkedListCpp","owner":"BaseMax","description":"This is a simple implementation of a one-way linked-list in C++.","archived":false,"fork":false,"pushed_at":"2022-11-28T12:50:17.000Z","size":45,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-05T23:02:16.895Z","etag":null,"topics":["cpp","linkedlist","linkedlist-c","linkedlist-delete","linkedlist-implementation","linkedlist-insert","linkedlist-reverse","linkedlists","linkedlists-using-class"],"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/BaseMax.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-11-26T12:26:22.000Z","updated_at":"2022-11-26T14:29:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"e82e2f8b-7541-4abd-9d6c-83a915dc582b","html_url":"https://github.com/BaseMax/OneWayLinkedListCpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BaseMax/OneWayLinkedListCpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FOneWayLinkedListCpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FOneWayLinkedListCpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FOneWayLinkedListCpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FOneWayLinkedListCpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/OneWayLinkedListCpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FOneWayLinkedListCpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34466928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","linkedlist","linkedlist-c","linkedlist-delete","linkedlist-implementation","linkedlist-insert","linkedlist-reverse","linkedlists","linkedlists-using-class"],"created_at":"2025-02-09T09:20:18.020Z","updated_at":"2026-06-17T21:31:28.374Z","avatar_url":"https://github.com/BaseMax.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# One-Way Linked-List C++\r\n\r\nThis is a simple implementation of a one-way linked-list in C++.\r\n\r\n## Functions\r\n\r\n- **`OneWayLinkedList()`**: Constructor\r\n- **`addBegin(int data)`**: Add new node to the beginning of the list\r\n- **`void addEnd(int data)`**: Add new node to the end of the list\r\n- **`void print()`**: Print all nodes\r\n- **`void deleteAll()`**: Delete all nodes\r\n- **`bool has(int data)`**: Check has a node with a specific data in the list or not\r\n- **`int getSize()`**: Get the size of the list\r\n- **`Node* getNode(int data)`**: Get the node by searching with data\r\n- **`void deleteNode(int data)`**: Delete a node with a specific data\r\n- **`Node* getNodeByIndex(int index)`**: Get the node by searching with index\r\n- **`void deleteNodeAfterIndex(int index)`**: Delete a node after a node with a specific index\r\n- **`void deleteNodeBeforeData(int data)`**: Delete a node before a node with a specific data\r\n- **`void deleteNodeByIndex(int index)`**: Delete a node with a specific index\r\n- **`void deleteNodeAfterData(int data)`**: Delete a node after a node with a specific index\r\n- **`void deleteNodeBeforeIndex(int index)`**: Delete a node before a node with a specific index\r\n- **`int count()`**: Count number of nodes\r\n- **`int countRecursive(Node* node)`**: Count number of nodes with a recursive function\r\n- **`Node* getFirstNode()`**: Get the first node\r\n- **`Node* getLastNode()`**: Get the last node\r\n- **`void reverse()`**: Reverse the list\r\n- **`void reverseRecursive(Node* node)`**: Reverse the list with a recursive function\r\n- **`Node* getMiddleNode()`**: Get the middle node\r\n- **`int OneWayLinkedList::hasNode(int data)`**: Check there is a node with a specific data in the list or not\r\n- **`int OneWayLinkedList::hasNodeRecursive(int data, Node* node)`**: Check there is a node with a specific data in the list or not (with a recursive function)\r\n- **`Node* mallocNode(int data)`**: Maloc a new node\r\n\r\n## Usage\r\n\r\n```c++\r\n// Create new list\r\nOneWayLinkedList* list = new OneWayLinkedList();\r\n\r\n// Add some nodes\r\nlist-\u003eaddEnd(1);\r\nlist-\u003eaddEnd(2);\r\nlist-\u003eaddEnd(3);\r\nlist-\u003eaddEnd(4);\r\nlist-\u003eaddEnd(5);\r\nlist-\u003eaddEnd(110);\r\nlist-\u003eaddBegin(100);\r\n\r\n// Print all nodes\r\nlist-\u003eprint();\r\n\r\n// Print the size of the list\r\ncout \u003c\u003c \"Size: \" \u003c\u003c list-\u003egetSize() \u003c\u003c endl;\r\n\r\n// Reverse the current list\r\ncout \u003c\u003c \"Reverse the list\" \u003c\u003c endl;\r\nlist-\u003ereverse();\r\n\r\n// Print all nodes\r\nlist-\u003eprint();\r\n\r\n// Reverse the current list with a recursive function\r\ncout \u003c\u003c \"Reverse the list with a recursive function\" \u003c\u003c endl;\r\nlist-\u003ereverseRecursive(list-\u003egetFirstNode());\r\n\r\n// Print all nodes\r\nlist-\u003eprint();\r\n\r\n// Print the middle node\r\nNode* middle = list-\u003egetMiddleNode();\r\nif (middle != NULL) {\r\n    cout \u003c\u003c \"Middle node: \" \u003c\u003c middle-\u003edata \u003c\u003c endl;\r\n} else {\r\n    cout \u003c\u003c \"Middle node: NULL\" \u003c\u003c endl;\r\n}\r\n\r\n// Print all nodes\r\nlist-\u003eprint();\r\n\r\n// Check has a node with a specific data in the list or not\r\ncout \u003c\u003c \"Has 110: \" \u003c\u003c list-\u003ehas(110) \u003c\u003c endl;\r\ncout \u003c\u003c \"Has 111: \" \u003c\u003c list-\u003ehas(111) \u003c\u003c endl;\r\n\r\n// Get the node by searching with data\r\nNode* node = list-\u003egetNode(110);\r\nif(node != NULL) {\r\n    cout \u003c\u003c \"Node data: \" \u003c\u003c node-\u003edata \u003c\u003c endl;\r\n} else {\r\n    cout \u003c\u003c \"Node not found\" \u003c\u003c endl;\r\n}\r\n\r\n// Get the node by searching with index\r\nnode = list-\u003egetNodeByIndex(0);\r\nif(node != NULL) {\r\n    cout \u003c\u003c \"Node data: \" \u003c\u003c node-\u003edata \u003c\u003c endl;\r\n} else {\r\n    cout \u003c\u003c \"Node not found\" \u003c\u003c endl;\r\n}\r\n\r\n// Get the node by searching with index\r\nnode = list-\u003egetNodeByIndex(60);\r\nif(node != NULL) {\r\n    cout \u003c\u003c \"Node data: \" \u003c\u003c node-\u003edata \u003c\u003c endl;\r\n} else {\r\n    cout \u003c\u003c \"Node not found\" \u003c\u003c endl;\r\n}\r\n\r\n// Print count of nodes\r\ncout \u003c\u003c \"Count: \" \u003c\u003c list-\u003ecount() \u003c\u003c endl;\r\n\r\n// Print count of nodes (recursive)\r\ncout \u003c\u003c \"Count (recursive): \" \u003c\u003c list-\u003ecountRecursive(list-\u003egetFirstNode()) \u003c\u003c endl;\r\n\r\n// Print the first node\r\nnode = list-\u003egetFirstNode();\r\nif(node != NULL) {\r\n    cout \u003c\u003c \"First node data: \" \u003c\u003c node-\u003edata \u003c\u003c endl;\r\n} else {\r\n    cout \u003c\u003c \"Node not found\" \u003c\u003c endl;\r\n}\r\n\r\n// Print the last node\r\nnode = list-\u003egetLastNode();\r\nif(node != NULL) {\r\n    cout \u003c\u003c \"Last node data: \" \u003c\u003c node-\u003edata \u003c\u003c endl;\r\n} else {\r\n    cout \u003c\u003c \"Node not found\" \u003c\u003c endl;\r\n}\r\n\r\n// Delete all nodes\r\nlist-\u003edeleteAll();\r\n\r\n// Print all nodes\r\nlist-\u003eprint();\r\n\r\n// Print the size of the list\r\ncout \u003c\u003c \"Size: \" \u003c\u003c list-\u003egetSize() \u003c\u003c endl;\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the GPL-3.0 License - see the [LICENSE](LICENSE) file for details.\r\n\r\n© Copyright (c) 2022 Max Base.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fonewaylinkedlistcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Fonewaylinkedlistcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fonewaylinkedlistcpp/lists"}