https://github.com/momen-alshouha/data-structure-circular-singly-linked-list
This repository contains C++ implementation of a circular 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-circular-singly-linked-list
circular-singly-linked-list classes-and-objects cpp data-structures linked-list oop-in-cpp oop-principles
Last synced: 5 months ago
JSON representation
This repository contains C++ implementation of a circular 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-circular-singly-linked-list
- Owner: Momen-Alshouha
- Created: 2024-01-12T08:09:49.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-13T14:29:43.000Z (almost 2 years ago)
- Last Synced: 2025-01-10T16:54:17.182Z (11 months ago)
- Topics: circular-singly-linked-list, classes-and-objects, cpp, data-structures, linked-list, oop-in-cpp, oop-principles
- 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
# Circular Singly Linked List Implementation in C++
This repository contains an implementation of a circular singly linked list using C++ and Object-Oriented Programming principles.
## Overview
### Classes
- **Node**: Represents individual nodes in the circular singly linked list.
- **Iterator**: Provides iteration capabilities over the linked list.
- **CircularSinglyLinkedList**: Implements the circular singly linked list and its functionalities.
## Classes and Functionality
### Node Class
The `Node` class represents individual elements in the circular singly linked list. Each node holds:
- `data`: Data of type `T`.
- `next`: Pointer to the next node.
### Iterator Class
The `Iterator` class provides functionality for iterating through the circular singly linked list. It includes methods to:
- Access node data.
- Set node data.
- Move to the next node.
- Access the current node.
### CircularSinglyLinkedList Class
The `CircularSinglyLinkedList` class implements a circular singly linked list with the following functionalities:
- Retrieving the head and tail nodes.
- Finding elements by value or index.
- Inserting elements at the beginning, end, or specific indices.
- Deleting nodes from the front, back, or at specific indices.
- Checking the existence of a value in the list.
- Concatenating two circular singly linked lists.
- Sorting the list in ascending or descending order.
- Removing duplicate elements.
- Swapping the positions of two elements.
- Updating the value of a specific node.
- Reversing the order of elements.
- Clearing the entire linked list.
- Printing the elements of the linked list.
## Usage
To use this circular 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 `CircularSinglyLinkedList.h`.
3. Create a `CircularSinglyLinkedList` object and utilize its functionalities as per your requirements.
## Example
```cpp
// Example usage of the CircularSinglyLinkedList class
#include "CircularSinglyLinkedList.h"
int main() {
CircularSinglyLinkedList myIntsList; // list of integers
CircularSinglyLinkedList myStringsList; // list of strings
// Perform operations like insertion, deletion, and retrieval here
return 0;
}