COS 102 Lecture Note 1
COS 102 Lecture Note 1
ng
COS 102
Problem Solving in Computer
Science
Lecture Note 1
Lecturer:
ASS. PROF
Akande O. N.O.
Noah AKANDE
(Ph. D.)
Problem Solving
▪ Computer Science is the study of problems,
problem-solving, and the solutions that come out of
this problem-solving process.
▪ This involves the use of computational tools
(computing devices etc) and methods
(programming languages)
2
Problem Solving
▪
4
Critical Thinking
▪ "Critical thinking in problem solving" refers to the
ability to analyze information, evaluate different
perspectives, and develop logical solutions to
challenges by systematically examining a problem,
gathering relevant data, and considering various
options before reaching a conclusion;
▪ Essentially, it's the process of actively thinking through
a situation to find the best possible solution.
5
Critical Thinking
▪ "Critical thinking in problem solving" refers to the
ability to analyze information, evaluate different
perspectives, and develop logical solutions to
challenges by systematically examining a problem,
gathering relevant data, and considering various
options before reaching a conclusion;
▪ Essentially, it's the process of actively thinking through
a situation to find the best possible solution.
6
Critical Thinking
▪
7
Problem Solving Strategies
8
Problem Solving Strategies
9
Problem Solving Strategies
▪ Brainstorming
– Gather a group of people, if possible, and engage in
brainstorming sessions.
– Encourage the generation of as many ideas and potential
solutions as possible,
– without criticism at this stage. Brainstorming can spark
creative thinking and lead to innovative solutions.
10
Problem Solving Strategies
11
Problem Solving Strategies
▪ Analogies
▪ Analogical thinking involves drawing parallels
between the current problem and similar problems
you have encountered or heard of in the past.
▪ By recognizing similarities, you can adapt solutions
from previous experiences to the current problem.
12
www.lmu.edu.ng
COS 102
Problem Solving Strategies
Lecture 2
Lecturer:
ASS. PROF O. N. AKANDE
Akande Noah O. (Ph. D.)
14
15
16
Problem Solving Strategies
17
Problem Solving Strategies
18
Problem Solving Strategies
▪ Seek Feedback
▪ Don't hesitate to seek feedback from peers,
mentors, or subject matter experts.
▪ They can provide valuable perspectives, spot
potential flaws in your approach, and suggest
alternative solutions.
19
Problem Solving Strategies
▪ Cross-disciplinary Thinking
▪ Explore solutions and ideas from other fields or
disciplines.
▪ Sometimes, a solution from an unrelated domain
can be adapted to solve a problem in a novel way.
21
Problem Solving Strategies
22
Problem Solving Strategies
▪ Ethical Considerations
▪ Always consider the ethical implications of your
solutions.
▪ Ensure that your chosen approach aligns with
ethical standards and doesn't harm individuals or
communities
23
Problem Solving Strategies
▪ Use Algorithms
▪ An algorithm is a step-by-step procedure or a set
of well-defined rules used to solve a specific
problem or perform a computation.
▪ It consists of a finite number of instructions that
take input, process it, and produce an output in a
systematic and predictable manner.
24
Problem Solving Process
▪ Step 1: Define the Problem
▪ Step 2: Analyze (Clarify) the problem
▪ Step 3: Develop potential solutions.
▪ Step 4: Evaluate the options
▪ Step 5: Select the best Option.
▪ Step 6: Implement the Solution.
▪ Step 7: Measure the Results.
25
Problem Solving Process: Step 1: Define the Problem
▪ This involves clearly understanding what needs to be
solved.
▪ This involves gathering requirements, identifying
inputs and expected outputs, and understanding
constraints.
▪ Ask questions like:
– What are the problem's boundaries?
– What should the final solution accomplish?
– Who are the users, and what do they need?
26
Step 2: Analyze (Clarify) the Problem
▪ Break the problem into smaller components to
better understand its complexity.
▪ Identify constraints, special cases, and
dependencies.
▪ Look at similar problems that have been solved
before and analyze their solutions.
27
Step 3: Develop Potential Solutions
▪ Brainstorm and list all possible solutions.
▪ Consider different algorithms, data structures, and
approaches.
28
Step 4: Evaluate the Options
29
Step 5: Select the Best Option
30
Step 6: Implement the Solution
35
Problem: Developing a Student Grade Calculator
36
Problem: Developing a Student Grade Calculator
38
Problem: Developing a Student Grade Calculator
39
Problem: Developing a Student Grade Calculator
▪ Step 7: Measure the Results
• Test Cases:
• Input: 75, 80, 90 → Output: A
• Input: 55, 60, 65 → Output: B
• Input: 30, 40, 50 → Output: D
• Input: -10, 50, 60 → Output: Invalid Input
• If the program works correctly for all cases, the solution
is valid. Otherwise, debugging is required.
40