Definition: A challenge or situation in computer science that needs to be overcome using computation, solved step-by-step, usually with well-defined input and desired output properties. |
Types of Problems | Description and Examples |
1. Decision Problems | - Requires binary response (Yes/No, True/False)
- Can be simple or complex
- Examples:
- Is a number odd or even?
- Is a number prime?
- Is "aa" in a sequence of English alphabets?
|
2. Search Problems | - Common in science and engineering
- Searches for solution among a set of objects
- Often represented as graphs
- Components:
- Initial State
- Operations
- Goal
- Example: Route Finding Problem (e.g., Google Maps)
|
3. Counting Problems | - Based on principle of combinations
- If A has X choices and B has Y choices, total combinations = X * Y
- Example: Outfit combinations = (number of shirts) * (number of pants)
- Complex example: Computer system configurations
|
Problem-Solving Approach | - Identify problem type
- Define inputs and desired outputs
- Break down into smaller steps
- Apply appropriate algorithms
- Verify solution against constraints
|