Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions llm/sorting-algorithm-explainer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Explain a Sorting Algorithm with Code (LLM Prompt)

## Objective:
Use a Large Language Model (LLM) like ChatGPT or DeepSeek to explain a sorting algorithm step-by-step, with a code example in Python.

---

## Prompt:
> “Explain how the Merge Sort algorithm works, step-by-step. Include a Python code implementation. Then describe the time and space complexity in simple terms. Finally, provide one use case where Merge Sort is better than Quick Sort.”

---

## Expected LLM Response Structure:
1. **Algorithm Explanation** – What it does and how it works
2. **Code Implementation** – Merge Sort in Python (with comments)
3. **Complexity Analysis** – Time and Space complexity
4. **Use Case Example** – When and why to prefer Merge Sort

---

## Test Scenario:
Try this prompt on ChatGPT-4, DeepSeek, or Ollama with LLaMA3 and verify if the response includes all expected parts.

---

## Use Case:
This LLM prompt helps software engineers or students quickly understand and visualize a commonly asked algorithmic topic like Merge Sort, backed by both theory and implementation.