An open API service indexing awesome lists of open source software.

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.

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.