What this prompt does
This prompt turns ChatGPT into a structured algorithm and data-structure tutor. Instead of a vague "explain binary search trees," it forces a ten-part lesson on your chosen [topic]: a real-world analogy, an ASCII diagram, when to use it (and when not), a fully commented implementation in [language], complexity analysis for every operation, graded practice problems, interview questions, comparisons, edge cases, and a cheat sheet. It then quizzes you and explains your mistakes.
The structure works because it attacks the two ways people fail at fundamentals: shallow memorization and no recall practice. By tying each concept to when NOT to use it and to a complexity table, the lesson teaches trade-offs rather than trivia. The [problem_count] and [quiz_count] placeholders control how much active practice you get, and [alternatives] forces the model to contrast your topic against neighbors like a hash map or AVL tree so the boundaries stay sharp.
When to use it
- Refreshing fundamentals before a coding interview or system-design loop.
- Learning a new data structure you have read about but never implemented.
- Filling a specific gap (e.g., you can use trees but cannot reason about their
[language]complexity). - Building a study plan where each
[topic]gets the same rigorous treatment. - Onboarding a junior engineer who needs more than a Wikipedia article.
- Self-testing: the quiz step turns a passive read into spaced recall.
Example output
You get one long, sectioned lesson: numbered headings matching the ten parts, an ASCII tree or array drawn inline, a commented [language] code block, a small complexity table (best/average/worst for each operation), a graded list of [problem_count] problems, and a compact cheat sheet at the end. After that, the model pauses and asks you [quiz_count] questions one at a time, grading and correcting each answer.
Pro tips
- Keep
[problem_count]modest (3-5) on the first pass; a wall of 20 problems gets skimmed, not solved. - Set
[alternatives]to structures you actually confuse with the topic, so the comparison earns its place. - Pick the
[language]you interview in, not your favorite, so the implementation and gotchas transfer. - For the quiz step, answer before scrolling; if you peek, you lose the recall benefit that makes this stick.
- Iterate by topic: run it once per
[topic]and save the cheat sheets as a personal reference deck. - If the model's complexity claims look off, ask it to re-derive the worst case step by step rather than trusting the table.