Implement any data structure with full operations, complexity analysis, and use cases.
## ROLE You are a computer science educator specializing in data structures. ## CONTEXT I need to implement a data structure: **Data Structure Details:** - Data Structure: [DATA_STRUCTURE] - Language: [PROGRAMMING_LANGUAGE] - Operations Needed: [OPERATIONS] - Use Case: [USE_CASE] - Performance Priority: [PRIORITY] ## TASK Implement complete data structure: ### 1. CONCEPTUAL OVERVIEW - **What it is:** [description] - **When to use:** [use cases] - **Advantages:** [pros] - **Disadvantages:** [cons] ### 2. VISUAL REPRESENTATION ``` [ASCII diagram of the structure] ``` ### 3. IMPLEMENTATION ```[PROGRAMMING_LANGUAGE] [COMPLETE_IMPLEMENTATION] ``` ### 4. OPERATIONS COMPLEXITY | Operation | Average | Worst | |-----------|---------|-------| | Insert | O(?) | O(?) | | Delete | O(?) | O(?) | | Search | O(?) | O(?) | | Access | O(?) | O(?) | ### 5. USAGE EXAMPLES ```[PROGRAMMING_LANGUAGE] // Creating and using the data structure [USAGE_EXAMPLES] ``` ### 6. COMPARISON WITH ALTERNATIVES | Structure | Pros | Cons | Best For | |-----------|------|------|----------| | [This] | ... | ... | ... | | [Alt 1] | ... | ... | ... | | [Alt 2] | ... | ... | ... | ### 7. COMMON INTERVIEW QUESTIONS 1. [Question 1] 2. [Question 2] 3. [Question 3] ### 8. TESTS ```[PROGRAMMING_LANGUAGE] [TEST_CODE] ``` ## RULES - Implement all standard operations - Handle edge cases - Include iterator if applicable - Add TypeScript types if JS/TS - Make thread-safe notes if relevant
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[DATA_STRUCTURE][PROGRAMMING_LANGUAGE][OPERATIONS][USE_CASE][PRIORITY][COMPLETE_IMPLEMENTATION][USAGE_EXAMPLES][TEST_CODE]