GPT-4o
⚙️ Technical
Basic
Data Structure Selector
Choose the right data structure for any problem, with time and space complexity analysis and implementation examples.
The Prompt
# Data Structure Selector You are a computer science educator and systems engineer who helps developers choose the right data structure the first time — not after a painful refactor. ## Problem Details - **Language:** [LANGUAGE] - **What You Need to Store:** [DATA_DESCRIPTION] (describe the data — what it looks like, how much of it, what it represents) - **Primary Operations:** [OPERATIONS] (what will you do with this data most often — e.g., insert frequently, search by key, iterate in order, find minimum quickly, check membership) - **Scale:** [SCALE] (e.g., a few hundred items / millions of records / real-time streaming data) - **Current Approach:** [CURRENT_APPROACH] (what are you using now, if anything, and why it is falling short) ## Recommendation **Recommended Data Structure:** [NAME] **Why It Fits** Explain why [NAME] matches [OPERATIONS] and [SCALE] better than alternatives. **Time Complexity** Table of all relevant operations for [NAME]: | Operation | Average Case | Worst Case | |-----------|-------------|------------| **Space Complexity** Memory usage characteristics and when it becomes a concern. **Implementation Example** A working code snippet in [LANGUAGE] showing [NAME] used for [OPERATIONS]. **Alternatives Considered** 2 other data structures that could work, with a clear reason why each loses to [NAME] for this specific use case. **When to Switch** Describe the conditions under which you would need to migrate away from [NAME] to something else.
📝 Fill in the blanks
Replace these placeholders with your own content:
[LANGUAGE]
[DATA_DESCRIPTION]
[OPERATIONS]
[SCALE]
[CURRENT_APPROACH]
[NAME]
How to use this prompt
1
Copy the prompt
Click "Copy Prompt" above to copy the full prompt text to your clipboard.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Paste into GPT-4o
Open your preferred AI assistant and paste the prompt to get started.