{"id":19725214,"url":"https://github.com/momen-alshouha/data-structure-stack","last_synced_at":"2025-08-13T19:40:27.403Z","repository":{"id":249246042,"uuid":"743023137","full_name":"Momen-Alshouha/data-structure-stack","owner":"Momen-Alshouha","description":"This repository contains C++ implementation of a stack using linked-list. It includes classes for stack item, iterator , and the stack itself, providing essential stack opreations such as push, pop, peek, and more. ","archived":false,"fork":false,"pushed_at":"2024-01-16T17:05:10.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-10T16:54:16.646Z","etag":null,"topics":["data-structures","stack"],"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/Momen-Alshouha.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":"2024-01-14T04:25:29.000Z","updated_at":"2024-07-19T06:53:10.000Z","dependencies_parsed_at":"2024-07-19T16:00:08.994Z","dependency_job_id":null,"html_url":"https://github.com/Momen-Alshouha/data-structure-stack","commit_stats":null,"previous_names":["momen-alshouha/data-structure-stack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Momen-Alshouha%2Fdata-structure-stack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Momen-Alshouha%2Fdata-structure-stack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Momen-Alshouha%2Fdata-structure-stack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Momen-Alshouha%2Fdata-structure-stack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Momen-Alshouha","download_url":"https://codeload.github.com/Momen-Alshouha/data-structure-stack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241045835,"owners_count":19899732,"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":["data-structures","stack"],"created_at":"2024-11-11T23:28:39.814Z","updated_at":"2025-02-27T18:52:31.212Z","avatar_url":"https://github.com/Momen-Alshouha.png","language":"C++","readme":"# Stack Implementation in C++\n\nThis repository contains a C++ implementation of a stack data structure using a linked list. The stack implementation is designed with Object-Oriented Programming principles.\n\n## Overview\n\n### Classes\n\n- **StackItem:** Represents individual elements in the stack.\n- **StackIterator:** Provides iteration capabilities over the stack.\n- **Stack:** Implements the stack and its functionalities.\n\n### Classes and Functionality\n\n#### StackItem Class\n\nThe `StackItem` class represents individual elements in the stack. Each item holds:\n\n- `_data`: Data of type T.\n- `_ptrNext`: Pointer to the next item.\n\n#### StackIterator Class\n\nThe `StackIterator` class provides functionality for iterating through the stack. It includes methods to:\n\n- Access item data.\n- Move to the next item.\n- Access the current item.\n\n#### Stack Class\n\nThe `Stack` class implements a stack with the following functionalities:\n\n- Retrieving the top item.\n- Getting the size of the stack.\n- Pushing elements onto the stack.\n- Popping elements from the stack.\n- Peeking at the top element without removing it.\n- Checking if the stack is empty or full.\n- Checking the existence of a value in the stack.\n- Clearing the entire stack.\n- Printing the elements of the stack.\n\n## Usage\n\nTo use this stack implementation, follow these steps:\n\n1. Clone the repository.\n2. Include the necessary header files in your C++ code: `StackItem.h`, `StackIterator.h`, and `Stack.h`.\n3. Create a `Stack` object and utilize its functionalities as per your requirements.\n\n## Example Usage of the Stack Class\n\n```cpp\n#include \"Stack.h\"\n\nint main() {\n    // Example with int data type and a maximum size of 10\n    Stack\u003cint, 10\u003e myStack;\n\n    // Pushing elements onto the stack\n    myStack.push(5);\n    myStack.push(10);\n    myStack.push(20);\n\n    // Peeking at the top element without removing it\n    int topElement = myStack.peek();\n    std::cout \u003c\u003c \"Top element: \" \u003c\u003c topElement \u003c\u003c std::endl;\n\n    // Popping elements from the stack\n    myStack.pop();\n\n    // Checking the size of the stack\n    std::cout \u003c\u003c \"Current stack size: \" \u003c\u003c myStack.size() \u003c\u003c std::endl;\n\n    // Checking if the stack is empty\n    if (myStack.isEmpty()) {\n        std::cout \u003c\u003c \"Stack is empty.\" \u003c\u003c std::endl;\n    } else {\n        std::cout \u003c\u003c \"Stack is not empty.\" \u003c\u003c std::endl;\n    }\n\n    // Printing the elements of the stack\n    std::cout \u003c\u003c \"Elements of the stack: \";\n    myStack.print();\n    \n    return 0;\n}\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomen-alshouha%2Fdata-structure-stack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmomen-alshouha%2Fdata-structure-stack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomen-alshouha%2Fdata-structure-stack/lists"}