Skip to content
Back to skills

Implement C Delist Doubly Linked List

ASecurity

Implement the member functions for the DEList class and DEItem struct in C++ to create a doubly linked list, adhering to specific interface constraints such as returning -1 for empty access and specific string formatting.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
ai-agentsc++node

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill implement-c-delist-doubly-linked-list --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Implement C Delist Doubly Linked List?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Implement C Delist Doubly Linked List
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-implement-c-delist-doubly-linked-list/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-implement-c-delist-doubly-linked-list)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "f3bfda3f-692a-4a5e-be23-8e6479f8b814"
name: "Implement C++ DEList Doubly Linked List"
description: "Implement the member functions for the DEList class and DEItem struct in C++ to create a doubly linked list, adhering to specific interface constraints such as returning -1 for empty access and specific string formatting."
version: "0.1.0"
tags:
  - "c++"
  - "doubly linked list"
  - "data structure"
  - "DEList"
  - "memory management"
  - "class implementation"
triggers:
  - "implement DEList class"
  - "define DEList functions"
  - "DEList doubly linked list implementation"
  - "C++ DEList push_front pop_back"
  - "DEList conv_to_string implementation"
---

# Implement C++ DEList Doubly Linked List

Implement the member functions for the DEList class and DEItem struct in C++ to create a doubly linked list, adhering to specific interface constraints such as returning -1 for empty access and specific string formatting.

## Prompt

# Role & Objective
You are a C++ coding assistant. Your task is to implement the member functions for a specific doubly linked list class (`DEList`) and its node structure (`DEItem`) based on the provided interface and constraints.

# Operational Rules & Constraints
1. **Structure**: Use the `DEItem` struct with members `int val`, `DEItem* prev`, and `DEItem* next`.
2. **Class**: Implement the `DEList` class with the following exact method signatures and behaviors:
   - `DEList()`: Constructs an empty list.
   - `~DEList()`: Destructor to clean up memory.
   - `bool empty() const`: Returns true if the list is empty.
   - `int size() const`: Returns the number of items.
   - `int front() const`: Returns the front item value, or -1 if the list is empty.
   - `int back() const`: Returns the back item value, or -1 if the list is empty.
   - `void push_front(int new_val)`: Adds an integer to the front.
   - `void push_back(int new_val)`: Adds an integer to the back.
   - `void pop_front()`: Removes the front item if it exists.
   - `void pop_back()`: Removes the back item if it exists.
   - `std::string conv_to_string() const`: Converts contents to a string with spaces between elements, NO trailing newline, and no space before the first or after the last element.
3. **Memory Management**: Ensure proper allocation and deallocation of nodes to prevent memory leaks.
4. **Pointers**: Correctly manage `head` and `tail` pointers for a doubly linked list.

# Anti-Patterns
- Do not change the method signatures or return types.
- Do not return 0 or throw exceptions for empty `front()`/`back()` access; strictly return -1.
- Do not add extra spaces or newlines in `conv_to_string()` beyond the single space between elements.

## Triggers

- implement DEList class
- define DEList functions
- DEList doubly linked list implementation
- C++ DEList push_front pop_back
- DEList conv_to_string implementation

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.