https://github.com/taharachedi/custom_queuearr_library-cpp
Not a standard queueβit's a unique implementation using my custom Dynamic Array class, modified for learning purposes while retaining core functionality.
https://github.com/taharachedi/custom_queuearr_library-cpp
data-structures queue
Last synced: 5 months ago
JSON representation
Not a standard queueβit's a unique implementation using my custom Dynamic Array class, modified for learning purposes while retaining core functionality.
- Host: GitHub
- URL: https://github.com/taharachedi/custom_queuearr_library-cpp
- Owner: taharachedi
- Created: 2025-03-07T12:02:15.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-03-07T12:08:11.000Z (10 months ago)
- Last Synced: 2025-03-20T07:53:36.068Z (9 months ago)
- Topics: data-structures, queue
- Language: C++
- Homepage:
- Size: 748 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π Queue Implementation (clsMyQueueArr) β‘
> **A C++ template-based queue implementation using a dynamic array (`clsDynamicArray`), supporting basic queue operations along with advanced functionalities. π**
---
## π Project Overview
The `clsMyQueueArr` class provides a **generic queue** implementation in C++, leveraging the `clsDynamicArray` class for efficient memory management and queue operations. It supports fundamental operations like **enqueue (push)**, **dequeue (pop)**, **peek front & back**, and extended functionalities for dynamic queue modifications.
### πΉ Core Functionalities:
- **Enqueue (Push) & Dequeue (Pop)** π
- **Access Front & Back Elements** π
- **Check Queue Size & Emptiness** π
- **Reverse Queue Elements** π
- **Modify & Insert Elements Within Queue** βοΈ
- **Clear the Queue in One Call** β¨
This queue implementation is **generic**, meaning it can store any data type using C++ templates.
---
## β¨ Features
### πΉ Basic Queue Operations
- **`Push(Value)`**: Adds an element to the back of the queue.
- **`Pop()`**: Removes the front element from the queue.
- **`Front()`**: Retrieves the front element of the queue.
- **`Back()`**: Retrieves the last element of the queue.
- **`Size()`**: Returns the number of elements in the queue.
- **`IsEmpty()`**: Checks if the queue is empty.
- **`Print()`**: Displays the queue elements.
### πΉ Extended Functionalities
- **`GetItem(Index)`**: Retrieves the value at a specific index.
- **`Reverse()`**: Reverses the order of queue elements.
- **`UpdateItem(Index, NewValue)`**: Updates the value at a given index.
- **`InsertAfter(Index, Value)`**: Inserts an element after a specified index.
- **`InsertAtFront(Value)`**: Inserts an element at the front of the queue.
- **`InsertAtBack(Value)`**: Inserts an element at the back of the queue.
- **`Clear()`**: Removes all elements from the queue.
---
## π How It Works
### πΉ Push & Pop
- Elements are added using `Push(Value)` at the **back** of the queue.
- Elements are removed using `Pop()` from the **front**.
### πΉ Accessing Elements
- `Front()` and `Back()` allow **direct access** to the first and last elements.
- `GetItem(Index)` retrieves an element at a specific position.
### πΉ Modifications & Reversal
- `UpdateItem(Index, NewValue)` modifies an existing value.
- `Reverse()` swaps element positions to **reverse** the queue order.
- `InsertAfter(Index, Value)`, `InsertAtFront(Value)`, and `InsertAtBack(Value)` allow **custom insertions**.
### πΉ Memory Management
- The queue dynamically allocates memory for new elements.
- `Clear()` safely removes all elements to prevent memory leaks.
---
## π Potential Enhancements
- π **Iterator Support**: Implementing iterators for STL-like traversal.
- β³ **Time Complexity Optimization**: Enhancing performance for large datasets.
- ποΈ **Persistent Storage**: Implementing file handling for saving queue data.
- π **Thread Safety**: Making the queue thread-safe for concurrent operations.
---
## βοΈ Technologies Used
- **Language**: C++
- **Templates**: Enables the queue to store any data type.
- **Dynamic Array-based Queue**: Uses `clsDynamicArray` for flexible data storage.
- **Memory Management**: Utilizes dynamic memory allocation.
---
## π― Learning Outcomes
This project demonstrates:
- β
**Queue operations (push, pop, front, back, size, empty check)**
- β
**Generic programming with C++ templates**
- β
**Efficient memory management with dynamic arrays**
- β
**Advanced queue modifications (insertion, reversal, updating)**
---
## π License
This project is **open-source**. Feel free to modify and enhance it! π
---
## π€ Contributing
Contributions are welcome! If you have ideas for improvements, submit a Pull Request.
---
## π Ready to Explore?
### π How to Run
1. **Download** the repository.
2. **Include** `clsMyQueueArr.h` in your project.
3. **Compile & Run** your C++ program with a standard compiler (e.g., `g++ main.cpp -o output`).
4. **Test** different queue operations.