https://github.com/momen-alshouha/data-structure-singly-linked-list
This repository contains C++ implementation of a singly linked list using object-oriented programming principles. It includes classes for nodes, iterators, and the linked list itself, providing essential functionalities such as insertion, deletion, traversal, and more.
https://github.com/momen-alshouha/data-structure-singly-linked-list
cpp crud-operation data-structures linked-list oop-principles singly-linked-list
Last synced: 8 days ago
JSON representation
This repository contains C++ implementation of a singly linked list using object-oriented programming principles. It includes classes for nodes, iterators, and the linked list itself, providing essential functionalities such as insertion, deletion, traversal, and more.
- Host: GitHub
- URL: https://github.com/momen-alshouha/data-structure-singly-linked-list
- Owner: Momen-Alshouha
- Created: 2024-01-08T03:34:29.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-12T07:46:32.000Z (over 2 years ago)
- Last Synced: 2025-02-28T01:20:41.427Z (over 1 year ago)
- Topics: cpp, crud-operation, data-structures, linked-list, oop-principles, singly-linked-list
- Language: C++
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Singly Linked List Implementation in C++
This repository contains an implementation of a singly linked list using C++ and Object-Oriented Programming principles.
## Overview
### Classes
- **Node**: Represents individual nodes in the singly linked list.
- **Iterator**: Provides iteration capabilities over the linked list.
- **LinkedList**: Implements the singly linked list and its functionalities.
## Classes and Functionality
### Node Class
The `Node` class represents individual elements in the singly linked list. Each node holds:
- `_Data`: Data of type `T`.
- `_ptrToNextNode`: Pointer to the next node.
### Iterator Class
The `Iterator` class provides functionality for iterating through the singly linked list. It includes methods to:
- Access node data.
- Set node data.
- Move to the next node.
- Access the current node.
### LinkedList Class
The `LinkedList` class implements a basic singly linked list with the following functionalities:
- Retrieving the head and tail nodes.
- Finding elements by index or data.
- Inserting elements before or after specified nodes or at specific indices.
- Deleting nodes by data or index.
- Concatenating two linked lists.
- Calculating the sum of elements (if the template type is arithmetic).
- Getting the length of the linked list.
## Usage
To use this singly linked list implementation, follow these steps:
1. Clone the repository.
2. Include the necessary header files in your C++ code: `Node.h`, `Iterator.h`, and `LinkedList.h`.
3. Create a `LinkedList` object and utilize its functionalities as per your requirements.
## Example
```cpp
// Example usage of the LinkedList class
#include "LinkedList.h"
int main() {
LinkedList myIntsList; // list of integers
LinkedList myStringsList; // list of strings
// Perform operations like insertion, deletion, and retrieval here
return 0;
}