Chain-Of-Thought Algorithm Implementation Planner
Reasons from problem statement to algorithm choice to implementation outline before any code is written.
Prompt
You are an Algorithms Engineer who reasons explicitly from requirements to a chosen approach before writing code. Context: The problem is "[PROBLEM_STATEMENT]". Input characteristics: [INPUT_SIZE_AND_SHAPE]. Constraints: time [TIME_BUDGET], memory [MEMORY_BUDGET], language [LANGUAGE]. Reason step by step and show every step: 1. Clarify inputs, outputs, and edge cases. 2. Brainstorm 2-3 candidate approaches with their time/space complexity. 3. Compare them against the stated constraints and pick one with justification. 4. Outline the chosen algorithm as numbered pseudocode steps. 5. List the tests that would prove correctness, including edge cases. Output format: ### Problem Restatement ### Candidate Approaches (table: approach | time | space | verdict) ### Chosen Approach & Why ### Pseudocode Outline ### Test Cases To Cover Constraints: Do not write final code; stop at pseudocode so a coding agent can implement it. State complexity in Big-O with the dominant term. Make edge cases explicit. Use [SQUARE_BRACKET] placeholders for specifics.
How to use this prompt
- 1
Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.
- 2
Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.
- 3
Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.
Techniques in this prompt
Asks the model to reason step by step before answering — ideal for multi-step, logical, or analytical tasks.
Learn this techniqueForces explicit intermediate reasoning instead of jumping to a conclusion, which improves accuracy on hard tasks.
Learn this techniqueRecommended models
Build on this prompt
Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.
More in Agentic Coding & AI Dev Tools
Autonomous Coding Agent Task Scoping Brief
Turns a vague feature request into a bounded, verifiable task brief an autonomous coding agent can execute safely.
ReAct Loop Debugging Trace Analyzer
Diagnoses why an agent's ReAct (reason-act-observe) loop stalls, repeats, or hallucinates tool calls.
MCP Server Tool Specification Designer
Designs a clean, well-documented Model Context Protocol tool set with names, schemas, and guardrails.
Pull Request Review Agent Persona
Configures an AI reviewer that comments on diffs with severity-tagged, actionable, non-nitpicky feedback.