--- id: wiki-2026-0508-problem-solving title: Problem Solving category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Problem Solving, 문제 해결, decomposition] duplicate_of: none source_trust_level: A confidence_score: 0.9 verification_status: applied tags: [methodology, meta, decomposition, heuristics] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: meta framework: methodology --- # Problem Solving ## 매 한 줄 > **"매 큰 문제를 매 작은 문제로 매 쪼개고 매 합쳐라"**. Problem Solving은 매 ill-defined situation을 매 well-defined sub-problem 으로 매 decompose 하고 매 solve → compose 하는 매 universal methodology. Polya (1945) 부터 매 modern algorithmic thinking, 매 LLM tool-use planning 까지 매 backbone. ## 매 핵심 ### 매 4-step (Polya) 1. **Understand**: input/output/constraint 매 명확화. 2. **Plan**: 매 known problem과 매 mapping, 매 sub-goal 분해. 3. **Execute**: 매 plan 매 step-by-step. 4. **Review**: 매 verify, 매 generalize. ### 매 Heuristic toolkit - **Decomposition**: divide-and-conquer. - **Analogy**: 매 known problem → 매 transform. - **Working backward**: goal에서 매 출발. - **Invariant**: 매 변하지 않는 property 매 식별. - **Specialization**: 매 simpler case 먼저. - **Generalization**: 매 더 일반 case로 매 abstract. ### 매 응용 1. Algorithm design. 2. System architecture (decomposition into services). 3. Debugging (Problem Solving Skills 참고). 4. LLM agent planning (ReAct, ToT). 5. Research project scoping. ## 💻 패턴 ### Decomposition template ```python # 매 1. Restate # Goal: 매 sort N items by key with stable + in-place # Inputs: list[T]; Outputs: list[T] sorted # Constraints: stable, O(1) extra space, T comparable # 매 2. Plan — sub-problems # (a) partition pivot (in-place quicksort) # (b) but quicksort 매 unstable → swap to merge sort? # (c) merge sort 매 not in-place → block merge sort (Wikisort) # 매 3. Execute — pick block merge sort def block_merge_sort(a): ... # 매 implement # 매 4. Review — invariants, edge cases (empty, dupes, all-equal) ``` ### Working backward (puzzle solving) ```python # Find x such that f(g(h(x))) == target # Backward: y = f^-1(target); z = g^-1(y); x = h^-1(z) def backward(target, inverses): cur = target for inv in reversed(inverses): cur = inv(cur) return cur ``` ### Invariant-based proof (loop) ```python def gcd(a, b): # 매 Invariant: gcd(a0, b0) == gcd(a, b) at every iteration while b: a, b = b, a % b return a ``` ### Specialization → Generalization ```python # 매 Step 1 — special case: 매 sorted list, no duplicates def find_special(arr, t): lo, hi = 0, len(arr)-1 while lo <= hi: mid = (lo+hi)//2 if arr[mid] == t: return mid if arr[mid] < t: lo = mid+1 else: hi = mid-1 return -1 # 매 Step 2 — generalize: 매 with duplicates → leftmost binary search def find_general(arr, t): lo, hi = 0, len(arr) while lo < hi: mid = (lo+hi)//2 if arr[mid] < t: lo = mid+1 else: hi = mid return lo if lo < len(arr) and arr[lo] == t else -1 ``` ### LLM agent decomposition (ReAct loop) ```python # 매 Pseudo-ReAct def solve(task, llm, tools, max_steps=10): history = [{"role": "user", "content": task}] for _ in range(max_steps): out = llm.chat(history) # Thought + Action if out.is_final: return out.answer result = tools[out.action](out.args) # Observation history += [out.message, {"role": "tool", "content": result}] return None ``` ## 매 결정 기준 | 상황 | Approach | |---|---| | Algorithm puzzle | Polya + decomposition | | System design | Component decomposition + interface | | Debugging | [[Problem Solving Skills]] (repro/bisect) | | Research | Specialization → generalization | | LLM agent | ReAct / Tree-of-Thoughts | **기본값**: Understand → Decompose → Solve smallest → Compose → Review. ## 🔗 Graph - 변형: [[Polya-Method]] - 응용: [[System-Architecture]] - Adjacent: [[Problem Solving Skills]] · [[Heuristic]] · [[ReAct]] ## 🤖 LLM 활용 **언제**: ill-defined task scoping, 매 multi-step planning, 매 agentic workflow 설계. **언제 X**: 매 1-line trivial task. ## ❌ 안티패턴 - **매 Skip understanding**: 매 problem 매 명확하지 않은 채 매 코딩 시작. - **매 Premature optimization**: 매 sub-problem 매 미해결인데 매 perf tune. - **매 No review**: 매 동작하면 매 commit, 매 generalization 안 함. - **매 Cargo-cult algorithm**: 매 비슷한 문제의 매 solution 매 무비판 복붙. ## 🧪 검증 / 중복 - Verified (Polya "How to Solve It" 1945, Schoenfeld "Mathematical Problem Solving" 1985). - 신뢰도 A. - 관련: [[Problem Solving Skills]] (debugging-focused sibling). ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — Polya + heuristic toolkit + algorithmic patterns |