0% found this document useful (0 votes)
28 views

COS 102 Lecture Note 1

The document outlines problem-solving strategies in computer science, emphasizing critical thinking and systematic approaches to analyzing and resolving issues. It details various methods such as brainstorming, trial and error, and the use of algorithms, along with a structured problem-solving process consisting of defining, analyzing, developing, evaluating, selecting, implementing, and measuring solutions. Additionally, it provides a practical example of developing a student grade calculator, illustrating the application of these strategies.

Uploaded by

abdulahibarakah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

COS 102 Lecture Note 1

The document outlines problem-solving strategies in computer science, emphasizing critical thinking and systematic approaches to analyzing and resolving issues. It details various methods such as brainstorming, trial and error, and the use of algorithms, along with a structured problem-solving process consisting of defining, analyzing, developing, evaluating, selecting, implementing, and measuring solutions. Additionally, it provides a practical example of developing a student grade calculator, illustrating the application of these strategies.

Uploaded by

abdulahibarakah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

www.lmu.edu.

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

Computer Science is the study of


problems, problem-solving, and the
solutions that come out of this
problem-solving process.
3

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

▪ Understanding the Problem


– Defining the problem statement
– Identifying the constraints
– Clarifying what the desired outcome or
solution should look like

8
Problem Solving Strategies

▪ Divide and Conquer


– Break down complex problems into smaller,
more manageable sub-problems.
– Address each sub-problem individually, and then
– Integrate the solutions to form a complete
solution.

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

▪ Trial and Error


▪ This involves starting with a potential solution, test
it, and adjust based on the results.
▪ This method is particularly useful for hands-on or
practical problems.

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

▪ Use Visual Tools


▪ Visual aids, such as graphs, diagrams, and mind
maps, can help you visualize the problem and its
components.
▪ Flowcharts, in particular, are useful for illustrating
the flow of a process or algorithm.

17
Problem Solving Strategies

▪ Prioritize and Plan


▪ Once you have multiple potential solutions,
prioritize them based on feasibility, impact, and
other relevant criteria.
▪ Create a plan that outlines the steps needed to
implement your chosen solution.

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

▪ Persist and Iterate


▪ Problem solving can be a challenging and iterative
process.
▪ Be persistent, and don’t be discouraged by
setbacks or failures.
▪ Learn from your experiences, adjust your
approach, and continue working toward a solution.
20
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

▪ Reflect and Learn


▪ After solving a problem, take the time to reflect on
the process.
▪ What worked well and what could be improved?
▪ Learning from your problem-solving experiences
enhances your skills over time.

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

▪ Compare solutions based on:


– Efficiency (Time Complexity, Space Complexity)
– Scalability (Will it work for larger datasets?)
– Feasibility (Can it be implemented with available
resources?)
– Accuracy (Does it produce correct results in all cases?)

29
Step 5: Select the Best Option

▪ Choose the most optimal solution based on


evaluation.
▪ Consider real-world constraints like hardware
limitations, execution time, and ease of
implementation.

30
Step 6: Implement the Solution

▪ Write the algorithm in a programming language.


▪ Follow structured programming principles:
– Use functions for modularity.
– Apply error handling and exception handling.
– Optimize memory usage and execution speed.
▪ Test the implementation using various test cases
(including edge cases).
31
Step 7: Measure the Results
▪ Evaluate the solution's performance:
– Does it solve the problem as expected?
– How does it perform in different environments?
– Are there any unforeseen issues?
▪ Use debugging tools and profiling to optimize
performance.
▪ If the results are unsatisfactory, refine the solution and
repeat steps if necessary.
32
33
Problem: Developing a Student Grade Calculator
▪ Step 1: Define the Problem
▪ The goal is to write a program that calculates a
student's grade based on their scores.
▪ Input: The program should take marks for three
subjects.
▪ Output: The program should calculate the average
score and determine the student's grade using a
grading scale (A, B, C, D, F).
▪ Constraints: Marks should be between 0 and 100.
34
Problem: Developing a Student Grade Calculator
▪ Step 2: Analyze the Problem
▪ The program must take three inputs (marks for three
subjects).
▪ It must compute the average score and match it to a
grading scale.
▪ If a student enters invalid marks (e.g., negative
numbers or numbers greater than 100), the program
should handle this gracefully.

35
Problem: Developing a Student Grade Calculator

▪ Step 3: Develop Potential Solutions


▪ There are multiple ways to solve this problem:
▪ Using if-else statements to classify grades.
▪ Using a dictionary or switch case
▪ Using mathematical formulas

36
Problem: Developing a Student Grade Calculator

▪ Step 4: Evaluate the Options


▪ If-else statements are easy for beginners to
understand.
▪ A dictionary-based approach is more efficient but
might be harder for beginners.
▪ The if-else approach is chosen as it is simple and
straightforward.
37
Problem: Developing a Student Grade Calculator

▪ Step 5: Select the Best Option


▪ The if-else approach is selected because it is
beginner-friendly, easy to understand, and works
well for a grading system.

38
Problem: Developing a Student Grade Calculator

▪ Step 6: Implement the Solution


▪ Use any programming language of your choice to
implement the solution

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

You might also like