SlideShare a Scribd company logo
Algorithmic Thinking with
Python
SEMESTER S1
Outline
Syllabus Module 1 PART-1
WHAT IS PROBLEM SOLVING?
Problem-solving strategies
1 / 48
3 / 48
Text Books
Examples of
Problem
5 / 48
In our daily life, we encounter problems that are big and small.
Some are easy to solve and some tough to solve.
Some required structured solution and some unstructured
approach. Some are interesting and some are not.
PROBLEM SOLVING
8 / 48
Definition: Problem solving is the process of transforming the
description of a problem into the solution by using our knowledge and
by relying on our ability to select and use appropriate problem-solving
strategies and tools to implement.
STEPS:
► Problem solving is the act of defining a problem;
► Determining the cause of the problem;
► Identifying, prioritizing, and selecting alternatives for a solution;
► And then implementing a solution.
Problem Solving
Chart
9 / 48
Phase 1: Understanding the
problem.
10 / 48
► Differentiate fact from opinion, Specify underlying causes.
► Consult each faction involved for information.
► State the problem specifically.
► Draw a figure. Introduce suitable notation if required.
► Identify what standard or expectation is violated Determine in
which process the problem lies and avoid trying to solve the
problem without data.
Phase 2: Devising a
plan.
11 / 48
► Have you seen the same problem or in a slightly different form?.
► Do you know a related problem with given known.
► Look at the unknown! Try to think of a familiar problem
having the same or similar unknown.
► Split the problem into smaller, simpler sub-problems.
► If you cannot solve the proposed problem , solve some related
problem or solve a more general problem. Or a special case of the
problem. Or solve a part of the problem.
Phase 3: Carrying out the
plan.
12 / 48
► Carrying out your plan of the solution, check each
step.
► Can you see clearly that the step is correct?
► Can you prove that it is correct?
Phase 4: Looking
back
13 / 48
► Can you check the result?
► Can you derive the result differently?
► Can you use the result, or the method, for some other
problem?
Classes of
Problems
14 / 48
Problems can be classified into two categories
1. Well-defined problems
2. Ill-defined problems.
Well-defined problems comes with the following
properties:
► The problem has a clearly defined given state.
► There is a finite set of operators
► The problem has a clear goal state:
Well defined problem
Example
15 / 48
The game of chess
Initial state is defined by the players lined up on the chess-board for
the opening move. The final goal state is defined as checkmate. The
operators are the legal moves of the game that help achieve the sub-
goals and eventually the final goal of checkmate.
The Hanoi Tower Problem
The player is given a set of rules to start with-the discs of different
sizes are stacked on the first of three pegs. The problem is well
defined- the discs have to be moved to the third peg, while doing so,
only the top disc can be moved to the other peg, with the restrictions
that only one disc can be moved at one time and no larger disc can be
placed on a smaller disc.
Ill defined
problems
16 / 48
► no clear initial conditions.
► no completely specified goals.
► a large number of unpredictable solutions.
► no defined set of operators or algorithms.
Example: “Please paint a beautiful picture”
Since solutions to ill-defined problems may be ambiguous, it is not
possible to forecast whether an algorithm may fit the initial
requirements. For this reason, ill-defined problems cannot be solved
in a routine way.
Outline
Syllabus Module 1 PART-1
WHAT IS PROBLEM SOLVING?
Problem-solving strategies
17 / 48
Problem-solving
strategies
18 / 48
An individual uses various kinds of methods or strategies to
solve problems.
Some strategies may take a longer time but definitely gives an answer.
On the other hand some strategies take less time but do not always
guarantee success.
These strategies can be mainly classified as
► Trial and Error
► Algorithm and Heuristic
► Means-Ends Analysis
► Backtracking
Importance of Understanding Multiple Problem-
Solving Strategies
19 / 48
Different problems often require different approaches, and being
familiar with multiple strategies allows for greater flexibility and
adaptability. For example, some problems might be best solved
through a systematic trial and error method, while others might
benefit from a more analytical approach like means-ends analysis.
By knowing several strategies, one can quickly switch tactics when
one method does not work, increasing the chances of finding a
successful solution.
Benefits of Multiple Problem-Solving
Strategies
20 / 48
► Adaptability: Different problems require different approaches
which allows for flexibility and adaptability in problemsolving.
► Efficiency: Some strategies are more effective for specific
types of problems. They can save time and resources.
► Improved Outcomes: Diverse strategies offer multiple
perspectives and potential solutions, increasing the likelihood
of finding optimal solutions.
► Skill Development: Exposure to various strategies
enhances cognitive skills, critical thinking, and creativity.
Trial and
Error
21 / 48
One of the most common problem-solving strategies is trial and error.
This method, often utilized in simple situations, involves
experimenting with different approaches until a satisfactory outcome
is achieved.
For example, say the problem is that your Wi-Fi isn’t working. You
might try different things until it starts working again, like restarting
your modem or your devices until you find or resolve the problem.
When one solution isn’t successful, you try another until you find what
works.
PROBLEM: HOW TO CROSS THE RIVER?
A farmer with a fox,a goose, and a sack of corn
needs to cross a river. The farmer has a boat, but
there
is room for only the farmer and one of his three
items. Unfortunately, both the fox and the goose
are hungry. The fox cannot be left alone with the
goose, or the fox will eat the goose. Likewise, the
goose cannot be left alone with the sack of corn,
or the goose will eat the corn. How does the
farmer get everything across the river?
22 / 48
Solution: HOW TO CROSS THE RIVER?
23 / 48
Trial and
Error
24 / 48
The trial-and-error problem-solving strategy involves attempting
different solutions and learning from mistakes until a successful
outcome is achieved. It is a fundamental method that relies on
experimentation and iteration, rather than systematic or analytical
approaches. Consider the situation where you have forgotten the
password to your online account, and there is no password recovery
option available. You decide to use trial and error to regain access:
Steps to recover
password
25 / 48
1.Initial Attempts: You start by trying passwords you commonly use.
Eg: ”password123,” ”Qwerty2024,” etc
2.Learning from Mistakes: None of these initial attempts work. You
try variations incorporating your birthdate, pet’s name, or favorite
sports team.
3.Refinement: After several failed attempts, you remember you
recently started using a new format for your passwords, combining a
favorite quote with special characters. You attempted various
combinations, such as”ToBeOrNotToBe!” and other combinations.
4.Success: Eventually, through persistent trial and error, you hit upon
the correct password: ”ToBeOrNotToBe!2024.”
Algorith
m
26 / 48
Algorithms are generally procedures that, if applied correctly, give
accurate solutions.An algorithm is a set of precise and unambiguous
instructions that can be followed to achieve a specific goal or solve a
particular problem. For example, if you want to sort a list of numbers
in ascending order, you can use an algorithm that compares each pair
of numbers and swaps them if they are out of order. An algorithm can
be implemented in any programming language, and it should always
produce the same output for the same input.
27 / 48
Heuristi
c
28 / 48
Heuristics are a general problem-solving strategy that may not always
guarantee an optimal solution but can be more practical or efficient in
certain situations. Heuristics are often used when the complexity of a
problem makes it impractical to find an optimal solution, relying
instead on educated guesses or rules of thumb to guide decision-
making. It is also used when lesser time is required to find a solution.
The benefit of heuristics in helping us reach decisions fairly easily also
has a disadvantage: the solution provided by the use of heuristics is
not necessarily the best one.
Heuristic
Examples
29 / 48
Heuristics are shortcut strategies that people can use to solve a
problem at hand.
If you find yourself sitting in a traffic jam, for example, you may
quickly consider other routes, taking one to get moving once again.
When shopping for a new car, you might think back to a prior
experience when negotiating got you a lower price, then employ
the same tactics.
While heuristics may be helpful when facing smaller issues, major
decisions shouldn’t necessarily be made using a shortcut
approach to reach an inaccurate solution.
How are they
related?
30 / 48
Both algorithms and heuristics are ways of solving problems, but they
have different advantages and disadvantages. Algorithms are more
reliable and accurate, but they can also be more complex and time-
consuming.
Heuristics are more flexible and efficient, but they can also be more
error-prone and biased. We can combine algorithms and heuristics
to create hybrid solutions that balance the trade-offs. For example,
you can use a heuristic to narrow down the search space, and then
apply an algorithm to find the best solution within that space.
Means-Ends
Analysis
31 / 48
Means-end analysis is a problem-solving strategy that, to put it
simply, helps you get from “point A” to “point B” by examining and
coming up with solutions to obstacles.
Means-ends analysis is a strategy that involves breaking down a
problem into smaller, manageable parts (means) and addressing each
part to achieve the final goal (ends). It involves identifying the current
state, the desired end state, and the steps needed to bridge the gap
between the two.
Means-Ends Analysis Example
1
32 / 48
Imagine you want to plan a road trip from Trivandrum to Kashmir.
Here is how you might use means-ends analysis.
1. Define the Goal:Drive from Trivandrum to Kashmir.
2. Analyze the Current State: You start in Trivandrum.
3. Identify the Differences: Distance between Trivandrum and
Kashmir is approximately 3,700 kilometers.
4. Set Sub-Goals (Means):
Fuel and Rest Stops: Where to stop for fuel and rest.
Daily Driving Targets: Break the trip into daily segments, such
as driving 500-600 km per day.
Route Planning: Choose the most efficient and scenic route,
considering highways, weather conditions, and places you want to
visit.
Means-Ends Analysis Example
1
33 / 48
5. Implement the Plan:
•Day 1: Drive from Trivandrum to Bangalore, Karnataka (approx. 720
km). Refuel in Madurai, Tamil Nadu. Overnight stay in Bangalore.
•Day 2: Drive from Bangalore to Hyderabad, Telangana (approx. 570
km). Refuel in Anantapur, Andhra Pradesh. Overnight stay in
Hyderabad.
......
• Day 8: Drive from Jammu to Srinagar, Kashmir (approx. 270 km).
6. Adjust as Needed: Throughout the trip, you may need to make
adjustments based on traffic, road conditions, or personal
preferences.
Means-Ends Analysis Example
2
Another Example, is if we want to prepare a
chocolate ganache cake. We think of it as three
sub-goals- cake
, cream and the the chocolate ganache. Each has
its on set of actions to prepare them. Then
ultimately
we combine these subgoals to reach the final
product.
34 / 48
35 / 48
Tower of Hanoi
paradigm
36 / 48
Tower of Hanoi
paradigm
37 / 48
The actual Tower of Hanoi problem consists of three rods sitting
vertically on a base with a number of disks of different sizes that can
slide onto any rod. The puzzle starts with the disks in a neat stack in
ascending order of size on one rod, the smallest at the top making a
conical shape. The objective of the puzzle is to move the entire stack
to another rod obeying the following rules:
1. Only one disk can be moved at a time.
2.Each move consists of taking the upper disk from one of the stacks
and placing it on top of another stack or on an empty rod.
3. No larger disc may be placed on top of a smaller disk.
Tower of
Hanoi
38 / 48
With 3 disks, the puzzle can be solved in 7 moves. The minimal moves
required to solve a Tower of Hanoi puzzle is 2n
– 1, where n is the
number of disks. For example, if there were 14 disks in the tower, the
minimum amount of moves that could be made to solve the puzzle
would be 214
– 1 = 16,383 moves. There are various ways of
approaching the Tower of Hanoi or its related problems in addition to
the approaches listed above including an iterative solution, recursive
solution, non-recursive solution, a binary and Gray-code solutions,
and graphical representations. We wl see MEA Solution.
Tower of
Hanoi
39 / 48
3AC DIVIDED AS SUBGOALS
40 / 48
2AB DIVIDED AS SUBGOALS
41 / 48
2BC DIVIDED AS SUBGOALS
42 / 48
GRAPHICALLY
43 / 48
Working
Backwards
44 / 48
Working Backwards is a problem-solving strategy in which you start
with the end goal and work backward to figure out the steps
needed to get there. In other words, instead of starting from the
beginning and moving forward, you start from the end and move
backward. This strategy is commonly used in math problems that
ask you to find a starting value or figure out what happened before
a given situation.
Working Backwards-
Examples
Example 1: Sarah had some pens. She bought 34 pens. She then
threw away 29 pens as they were spoilt. In the end, she had 64 pens.
How many pens did Sarah have at first?
45 / 48
Working Backwards-
Examples
46 / 48
Always remember when we work backwards, everything will be
reversed, eg: instead of adding, we subtract.
We will start drawing the model from the end by drawing a box and
label it “End”. Put the end amount “64” in the box.
Draw arrow to point to the left, draw another box. On top of the arrow
write “+29” as “Sarah threw away 29 pens”. Instead of subtract, we
need to add. In the box, write “93” (64+29=93).
Draw another arrow to point to the left, draw another box. On top of
the arrow, write “-34” as Sarah bought 34 pens. Instead of adding,
we need to subtract. In the box, write “59” (93-34=59). Label the box
“At First” or “Before”.
Sarah had 59 pens at first.
Example
2:
47 / 48
Suppose you had to pick up your child from football practice at exactly
5:00
p.m. At what time should you leave? Well, let us say it takes 30 minutes
to get to the ballpark. We would better leave a 5-minute safety valve.
Okay, then we need to leave 35 minutes earlier, or not later than 4:25
p.m. Without even thinking about it, we were working backwards! Of
course, this is a very simple example of this strategy.
This strategy is used when the end result is clear, but the beginning
may be unclear due to some incidents that happened in between.
Summary of Problem Solving
Strategies
48 / 48

More Related Content

PPTX
Python first year btech Algorithmic thinking with python
PPTX
Problem Solving Strategies Pg Sem 1.pptx
PDF
PPT
psy420leceeeeeeeeeeeeeeeeeeeeeeeeture13.ppt
PPT
Problem Solfgfdffffffffffffffffffffffffffffffffff
PPT
CHapter 12 PROBLEM SOLVING.ppt
PPTX
Problem solving
PPTX
Problem solving
Python first year btech Algorithmic thinking with python
Problem Solving Strategies Pg Sem 1.pptx
psy420leceeeeeeeeeeeeeeeeeeeeeeeeture13.ppt
Problem Solfgfdffffffffffffffffffffffffffffffffff
CHapter 12 PROBLEM SOLVING.ppt
Problem solving
Problem solving

Similar to Algorithmic thinking with python Module 1.1 (20)

PDF
Problem solving and critical thinking.pdf
PPTX
Critical Consciousness problem construction.pptx
PPTX
Problem Solving & Decision Making Training.pptx
DOCX
chapter 13Problem Solving  and IntelligenceGeneral Problem.docx
DOCX
7 step Problem solving cycle project report
PPTX
Problem solving
PPT
Creative Problem Solving Skills For Staff
PPTX
Problem_Solving_Presentation_With_Images.pptx
PPTX
Making and problem solving skills-Akram Jabar Najim
PPTX
grp 8 cognitive ppt.pptx
PPTX
Problem Solving Basics
PPTX
Unit VI. 6. 6 A PROBLEM SOVING, DEFINITION, STEPS INVOLVED IN PROBLEM SOLVIN...
PPTX
Unit VI. 6. 6 A PROBLEM SOVING, DEFINITION, STEPS INVOLVED IN PROBLEM SOLVIN...
PPTX
problem characterstics.pptx
PDF
Problem solving & decision making
PPTX
1 - Problem Solving and Abstraction.pptx
PPTX
What is problem solving
PPT
Chapter-11.-Problem-solving-creativity_2.0 (1).ppt
PPTX
Problem Solving Strategies - Artificial Intelligence - Anna University - Regu...
DOCX
Csc 102 lecture note(introduction to problem solving)
Problem solving and critical thinking.pdf
Critical Consciousness problem construction.pptx
Problem Solving & Decision Making Training.pptx
chapter 13Problem Solving  and IntelligenceGeneral Problem.docx
7 step Problem solving cycle project report
Problem solving
Creative Problem Solving Skills For Staff
Problem_Solving_Presentation_With_Images.pptx
Making and problem solving skills-Akram Jabar Najim
grp 8 cognitive ppt.pptx
Problem Solving Basics
Unit VI. 6. 6 A PROBLEM SOVING, DEFINITION, STEPS INVOLVED IN PROBLEM SOLVIN...
Unit VI. 6. 6 A PROBLEM SOVING, DEFINITION, STEPS INVOLVED IN PROBLEM SOLVIN...
problem characterstics.pptx
Problem solving & decision making
1 - Problem Solving and Abstraction.pptx
What is problem solving
Chapter-11.-Problem-solving-creativity_2.0 (1).ppt
Problem Solving Strategies - Artificial Intelligence - Anna University - Regu...
Csc 102 lecture note(introduction to problem solving)
Ad

Recently uploaded (20)

PDF
PPT on Performance Review to get promotions
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Current and future trends in Computer Vision.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Construction Project Organization Group 2.pptx
DOCX
573137875-Attendance-Management-System-original
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Sustainable Sites - Green Building Construction
PPTX
OOP with Java - Java Introduction (Basics)
PDF
composite construction of structures.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT
Project quality management in manufacturing
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPT on Performance Review to get promotions
Internet of Things (IOT) - A guide to understanding
additive manufacturing of ss316l using mig welding
Current and future trends in Computer Vision.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Construction Project Organization Group 2.pptx
573137875-Attendance-Management-System-original
Safety Seminar civil to be ensured for safe working.
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Operating System & Kernel Study Guide-1 - converted.pdf
Sustainable Sites - Green Building Construction
OOP with Java - Java Introduction (Basics)
composite construction of structures.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Project quality management in manufacturing
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
UNIT 4 Total Quality Management .pptx
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Ad

Algorithmic thinking with python Module 1.1

  • 2. Outline Syllabus Module 1 PART-1 WHAT IS PROBLEM SOLVING? Problem-solving strategies 1 / 48
  • 5. Examples of Problem 5 / 48 In our daily life, we encounter problems that are big and small. Some are easy to solve and some tough to solve. Some required structured solution and some unstructured approach. Some are interesting and some are not.
  • 6. PROBLEM SOLVING 8 / 48 Definition: Problem solving is the process of transforming the description of a problem into the solution by using our knowledge and by relying on our ability to select and use appropriate problem-solving strategies and tools to implement. STEPS: ► Problem solving is the act of defining a problem; ► Determining the cause of the problem; ► Identifying, prioritizing, and selecting alternatives for a solution; ► And then implementing a solution.
  • 8. Phase 1: Understanding the problem. 10 / 48 ► Differentiate fact from opinion, Specify underlying causes. ► Consult each faction involved for information. ► State the problem specifically. ► Draw a figure. Introduce suitable notation if required. ► Identify what standard or expectation is violated Determine in which process the problem lies and avoid trying to solve the problem without data.
  • 9. Phase 2: Devising a plan. 11 / 48 ► Have you seen the same problem or in a slightly different form?. ► Do you know a related problem with given known. ► Look at the unknown! Try to think of a familiar problem having the same or similar unknown. ► Split the problem into smaller, simpler sub-problems. ► If you cannot solve the proposed problem , solve some related problem or solve a more general problem. Or a special case of the problem. Or solve a part of the problem.
  • 10. Phase 3: Carrying out the plan. 12 / 48 ► Carrying out your plan of the solution, check each step. ► Can you see clearly that the step is correct? ► Can you prove that it is correct?
  • 11. Phase 4: Looking back 13 / 48 ► Can you check the result? ► Can you derive the result differently? ► Can you use the result, or the method, for some other problem?
  • 12. Classes of Problems 14 / 48 Problems can be classified into two categories 1. Well-defined problems 2. Ill-defined problems. Well-defined problems comes with the following properties: ► The problem has a clearly defined given state. ► There is a finite set of operators ► The problem has a clear goal state:
  • 13. Well defined problem Example 15 / 48 The game of chess Initial state is defined by the players lined up on the chess-board for the opening move. The final goal state is defined as checkmate. The operators are the legal moves of the game that help achieve the sub- goals and eventually the final goal of checkmate. The Hanoi Tower Problem The player is given a set of rules to start with-the discs of different sizes are stacked on the first of three pegs. The problem is well defined- the discs have to be moved to the third peg, while doing so, only the top disc can be moved to the other peg, with the restrictions that only one disc can be moved at one time and no larger disc can be placed on a smaller disc.
  • 14. Ill defined problems 16 / 48 ► no clear initial conditions. ► no completely specified goals. ► a large number of unpredictable solutions. ► no defined set of operators or algorithms. Example: “Please paint a beautiful picture” Since solutions to ill-defined problems may be ambiguous, it is not possible to forecast whether an algorithm may fit the initial requirements. For this reason, ill-defined problems cannot be solved in a routine way.
  • 15. Outline Syllabus Module 1 PART-1 WHAT IS PROBLEM SOLVING? Problem-solving strategies 17 / 48
  • 16. Problem-solving strategies 18 / 48 An individual uses various kinds of methods or strategies to solve problems. Some strategies may take a longer time but definitely gives an answer. On the other hand some strategies take less time but do not always guarantee success. These strategies can be mainly classified as ► Trial and Error ► Algorithm and Heuristic ► Means-Ends Analysis ► Backtracking
  • 17. Importance of Understanding Multiple Problem- Solving Strategies 19 / 48 Different problems often require different approaches, and being familiar with multiple strategies allows for greater flexibility and adaptability. For example, some problems might be best solved through a systematic trial and error method, while others might benefit from a more analytical approach like means-ends analysis. By knowing several strategies, one can quickly switch tactics when one method does not work, increasing the chances of finding a successful solution.
  • 18. Benefits of Multiple Problem-Solving Strategies 20 / 48 ► Adaptability: Different problems require different approaches which allows for flexibility and adaptability in problemsolving. ► Efficiency: Some strategies are more effective for specific types of problems. They can save time and resources. ► Improved Outcomes: Diverse strategies offer multiple perspectives and potential solutions, increasing the likelihood of finding optimal solutions. ► Skill Development: Exposure to various strategies enhances cognitive skills, critical thinking, and creativity.
  • 19. Trial and Error 21 / 48 One of the most common problem-solving strategies is trial and error. This method, often utilized in simple situations, involves experimenting with different approaches until a satisfactory outcome is achieved. For example, say the problem is that your Wi-Fi isn’t working. You might try different things until it starts working again, like restarting your modem or your devices until you find or resolve the problem. When one solution isn’t successful, you try another until you find what works.
  • 20. PROBLEM: HOW TO CROSS THE RIVER? A farmer with a fox,a goose, and a sack of corn needs to cross a river. The farmer has a boat, but there is room for only the farmer and one of his three items. Unfortunately, both the fox and the goose are hungry. The fox cannot be left alone with the goose, or the fox will eat the goose. Likewise, the goose cannot be left alone with the sack of corn, or the goose will eat the corn. How does the farmer get everything across the river? 22 / 48
  • 21. Solution: HOW TO CROSS THE RIVER? 23 / 48
  • 22. Trial and Error 24 / 48 The trial-and-error problem-solving strategy involves attempting different solutions and learning from mistakes until a successful outcome is achieved. It is a fundamental method that relies on experimentation and iteration, rather than systematic or analytical approaches. Consider the situation where you have forgotten the password to your online account, and there is no password recovery option available. You decide to use trial and error to regain access:
  • 23. Steps to recover password 25 / 48 1.Initial Attempts: You start by trying passwords you commonly use. Eg: ”password123,” ”Qwerty2024,” etc 2.Learning from Mistakes: None of these initial attempts work. You try variations incorporating your birthdate, pet’s name, or favorite sports team. 3.Refinement: After several failed attempts, you remember you recently started using a new format for your passwords, combining a favorite quote with special characters. You attempted various combinations, such as”ToBeOrNotToBe!” and other combinations. 4.Success: Eventually, through persistent trial and error, you hit upon the correct password: ”ToBeOrNotToBe!2024.”
  • 24. Algorith m 26 / 48 Algorithms are generally procedures that, if applied correctly, give accurate solutions.An algorithm is a set of precise and unambiguous instructions that can be followed to achieve a specific goal or solve a particular problem. For example, if you want to sort a list of numbers in ascending order, you can use an algorithm that compares each pair of numbers and swaps them if they are out of order. An algorithm can be implemented in any programming language, and it should always produce the same output for the same input.
  • 26. Heuristi c 28 / 48 Heuristics are a general problem-solving strategy that may not always guarantee an optimal solution but can be more practical or efficient in certain situations. Heuristics are often used when the complexity of a problem makes it impractical to find an optimal solution, relying instead on educated guesses or rules of thumb to guide decision- making. It is also used when lesser time is required to find a solution. The benefit of heuristics in helping us reach decisions fairly easily also has a disadvantage: the solution provided by the use of heuristics is not necessarily the best one.
  • 27. Heuristic Examples 29 / 48 Heuristics are shortcut strategies that people can use to solve a problem at hand. If you find yourself sitting in a traffic jam, for example, you may quickly consider other routes, taking one to get moving once again. When shopping for a new car, you might think back to a prior experience when negotiating got you a lower price, then employ the same tactics. While heuristics may be helpful when facing smaller issues, major decisions shouldn’t necessarily be made using a shortcut approach to reach an inaccurate solution.
  • 28. How are they related? 30 / 48 Both algorithms and heuristics are ways of solving problems, but they have different advantages and disadvantages. Algorithms are more reliable and accurate, but they can also be more complex and time- consuming. Heuristics are more flexible and efficient, but they can also be more error-prone and biased. We can combine algorithms and heuristics to create hybrid solutions that balance the trade-offs. For example, you can use a heuristic to narrow down the search space, and then apply an algorithm to find the best solution within that space.
  • 29. Means-Ends Analysis 31 / 48 Means-end analysis is a problem-solving strategy that, to put it simply, helps you get from “point A” to “point B” by examining and coming up with solutions to obstacles. Means-ends analysis is a strategy that involves breaking down a problem into smaller, manageable parts (means) and addressing each part to achieve the final goal (ends). It involves identifying the current state, the desired end state, and the steps needed to bridge the gap between the two.
  • 30. Means-Ends Analysis Example 1 32 / 48 Imagine you want to plan a road trip from Trivandrum to Kashmir. Here is how you might use means-ends analysis. 1. Define the Goal:Drive from Trivandrum to Kashmir. 2. Analyze the Current State: You start in Trivandrum. 3. Identify the Differences: Distance between Trivandrum and Kashmir is approximately 3,700 kilometers. 4. Set Sub-Goals (Means): Fuel and Rest Stops: Where to stop for fuel and rest. Daily Driving Targets: Break the trip into daily segments, such as driving 500-600 km per day. Route Planning: Choose the most efficient and scenic route, considering highways, weather conditions, and places you want to visit.
  • 31. Means-Ends Analysis Example 1 33 / 48 5. Implement the Plan: •Day 1: Drive from Trivandrum to Bangalore, Karnataka (approx. 720 km). Refuel in Madurai, Tamil Nadu. Overnight stay in Bangalore. •Day 2: Drive from Bangalore to Hyderabad, Telangana (approx. 570 km). Refuel in Anantapur, Andhra Pradesh. Overnight stay in Hyderabad. ...... • Day 8: Drive from Jammu to Srinagar, Kashmir (approx. 270 km). 6. Adjust as Needed: Throughout the trip, you may need to make adjustments based on traffic, road conditions, or personal preferences.
  • 32. Means-Ends Analysis Example 2 Another Example, is if we want to prepare a chocolate ganache cake. We think of it as three sub-goals- cake , cream and the the chocolate ganache. Each has its on set of actions to prepare them. Then ultimately we combine these subgoals to reach the final product. 34 / 48
  • 35. Tower of Hanoi paradigm 37 / 48 The actual Tower of Hanoi problem consists of three rods sitting vertically on a base with a number of disks of different sizes that can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top making a conical shape. The objective of the puzzle is to move the entire stack to another rod obeying the following rules: 1. Only one disk can be moved at a time. 2.Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack or on an empty rod. 3. No larger disc may be placed on top of a smaller disk.
  • 36. Tower of Hanoi 38 / 48 With 3 disks, the puzzle can be solved in 7 moves. The minimal moves required to solve a Tower of Hanoi puzzle is 2n – 1, where n is the number of disks. For example, if there were 14 disks in the tower, the minimum amount of moves that could be made to solve the puzzle would be 214 – 1 = 16,383 moves. There are various ways of approaching the Tower of Hanoi or its related problems in addition to the approaches listed above including an iterative solution, recursive solution, non-recursive solution, a binary and Gray-code solutions, and graphical representations. We wl see MEA Solution.
  • 38. 3AC DIVIDED AS SUBGOALS 40 / 48
  • 39. 2AB DIVIDED AS SUBGOALS 41 / 48
  • 40. 2BC DIVIDED AS SUBGOALS 42 / 48
  • 42. Working Backwards 44 / 48 Working Backwards is a problem-solving strategy in which you start with the end goal and work backward to figure out the steps needed to get there. In other words, instead of starting from the beginning and moving forward, you start from the end and move backward. This strategy is commonly used in math problems that ask you to find a starting value or figure out what happened before a given situation.
  • 43. Working Backwards- Examples Example 1: Sarah had some pens. She bought 34 pens. She then threw away 29 pens as they were spoilt. In the end, she had 64 pens. How many pens did Sarah have at first? 45 / 48
  • 44. Working Backwards- Examples 46 / 48 Always remember when we work backwards, everything will be reversed, eg: instead of adding, we subtract. We will start drawing the model from the end by drawing a box and label it “End”. Put the end amount “64” in the box. Draw arrow to point to the left, draw another box. On top of the arrow write “+29” as “Sarah threw away 29 pens”. Instead of subtract, we need to add. In the box, write “93” (64+29=93). Draw another arrow to point to the left, draw another box. On top of the arrow, write “-34” as Sarah bought 34 pens. Instead of adding, we need to subtract. In the box, write “59” (93-34=59). Label the box “At First” or “Before”. Sarah had 59 pens at first.
  • 45. Example 2: 47 / 48 Suppose you had to pick up your child from football practice at exactly 5:00 p.m. At what time should you leave? Well, let us say it takes 30 minutes to get to the ballpark. We would better leave a 5-minute safety valve. Okay, then we need to leave 35 minutes earlier, or not later than 4:25 p.m. Without even thinking about it, we were working backwards! Of course, this is a very simple example of this strategy. This strategy is used when the end result is clear, but the beginning may be unclear due to some incidents that happened in between.
  • 46. Summary of Problem Solving Strategies 48 / 48