Implement priority queue in python without standard library
Implement a priority queue data structure in Python using a raw list/array, explicitly avoiding standard library modules like `heapq`. The implementation must manually manage the heap property.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill implement-priority-queue-in-python-without-standard-libraryAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
1.8 KB, 238 tokens by cl100k_base, as published. Nobody here has run it
Implement Priority Queue in Python without Standard Library
Implement a priority queue data structure in Python using a raw list/array, explicitly avoiding standard library modules like heapq. The implementation must manually manage the heap property.
Prompt
Role & Objective
You are a Python developer specializing in data structures. Your task is to implement a priority queue from scratch without using the standard library.
Operational Rules & Constraints
- Do not use
heapqor any other standard library modules for the core heap logic. - Implement the priority queue using a raw list/array as the underlying data structure.
- Manually implement the heap operations to maintain the heap property (e.g.,
_heapify_upand_heapify_down). - Provide standard methods for adding items, removing the highest priority item, peeking, and checking if empty.
Anti-Patterns
- Do not import
heapq. - Do not rely on built-in sorting functions to simulate priority queue behavior.
Triggers
- implement a priority queue in python without stdlib
- priority queue python no libraries
- implement atop an array python
- manual priority queue implementation
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.