3. “The computer is incredibly fast, accurate, and
stupid. Man is incredibly slow, inaccurate, and
brilliant. The marriage of the two is a force beyond
calculations”
…………….Leo Cherne
4. When you program, you have to solve out few problems
such as:
How am I going to write this
How exactly will this work
What all functions will I need
All of these depend on your critical & logical thinking. You
need to analyze these things to go on to solve problems,
and build your program.
7. decomposition - breaking down a complex problem or
system into smaller, more manageable parts
pattern recognition – looking for similarities among and
within problems
abstraction – focusing on the important information only,
ignoring irrelevant detail
algorithms - developing a step-by-step solution to the
problem, or the rules to follow to solve the problem
8. Computational thinking in practice
A complex problem is one that, at first glance, we don't know how to solve
easily.
Computational thinking involves taking that complex problem and
breaking it down into a series of small, more manageable problems
(decomposition). Each of these smaller problems can then be looked at
individually, considering how similar problems have been solved previously
(pattern recognition) and focusing only on the important details, while
ignoring irrelevant information (abstraction). Next, simple steps or rules to
solve each of the smaller problems can be designed (algorithms).
Finally, these simple steps or rules are used to program a computer to help
solve the complex problem in the best way.
10. Decomposition
Part of being a computer scientist is breaking down a big
problem into the smaller problems that make it up. If you
can break down a big problem into smaller problems, then
you can give them to a computer to solve.
11. Look at an example, the equation to work out the roots
of a quadratic equation:
12.
13. Pattern Recognition
By noting the steps down to solve a problem, we can
often recognize patterns, and by giving a list of steps,
we are one step closer to creating an algorithm.
14. we are often given a set of raw data and then are
asked to find the pattern behind it:
1, 4, 7, 10, 13, 16, 19, 22, 25, …
15. Once we have recognized patterns, we need to put it in
its simplest terms so that it can be used whenever we
need to use it. For example, if you were studying the
patterns of how people speak, we might notice that all
proper English sentences have a subject and a
predicate.
This is pretty easy with number sets, the above pattern
An=n+3.
16. ALGORITHM DESIGN
Once we have our patterns and abstractions, we can
start to write the steps that a computer can use to solve
the problem. We do this by creating Algorithms.
Algorithms are not computer code, but are
independent instructions that could be turned into
compute code. We often write these independent
instructions as pseudo code.
17. Designing algorithms
Determine the right steps
Determine the correct order of the steps
Follow the steps completely
Verify that the algorithm is working correctly
Determine if algorithm is the best" approach
for solving problem
21. Solution
If we break the problem up into smaller pieces, it
becomes easier to manage.
Let's start at the two ends. What is 200 + 1?
What is 199 + 2?
What is 198 + 3?
See a pattern?
22. How many of these pairs will we have? What is
the last pair we will find? 100 + 101
That means that we have 100 total pairs.
If we have 100 total pairs of sums of 201, how do
we find the final total?
What is 100 * 201?
23.
24. Can we do it easily with 2,000?
How about 20,000?
What stays the same? What is different?
If we use abstractions to make our end goal something
that can change (say we name it "blank") then we can
make an algorithm that will work for any number
25. Work through the problem until you ultimately get ? = ("blank"/2) *
("blank"+1)
Do a few simple examples to show that the algorithm is correct for blanks=
2, 3, 4, & 5.
26. "This is all to show that if you use the tools of
Computational Thinking (decomposition,
pattern matching, abstraction, and algorithms),
then you can figure out how to solve problems”
27. Computational Thinking (Example-2)
Konigsberg Bridge Problem
You may or may not have heard of a town in Prussia known
as Konigsberg. The people there had a very interesting
activity which came to be a puzzle among them. The town
had seven bridges which connected four pieces of land
(See Figure below). The task with which people challenged
each other was to walk over every bridge in the town
without crossing back over any bridge twice. You may
wonder why this was such a challenge or may even think
that it seems quite easy.
30. The puzzle was solved by mathematician Leonhard Euler
back in 1736, but it was not so much his solution but his way
of going about solving it that was revolutionary. He used
what are now core parts of a computer scientist’s
computational thinking toolkit.
31. What Euler realised was that the puzzle was easier to solve if
you threw away most of the information on the map of the
town. That is just the computational thinking idea of
abstraction: problems are easier to solve if you hide all
unnecessary information.
32. All you need for the bridge problem is information showing
the different land masses and how they are connected
(i.e. the bridges between them). He made it really simple
and drew small circles for each land mass (a circle for
each of the two islands and the two sides of the river). He
then drew lines between each pair of circles that were
connected by bridges. A computer scientist calls a picture,
or ‘representation’, like this a graph. The lines are called
the ‘edges’ and the circles the ‘nodes’ of the graph.
33.
34. he problem now becomes a question of whether you can
visit every node in the graph following each edge once
and only once. The simplified picture given by the graph
allowed Euler to see, when combined with some logical
thinking, the answer to the problem.
35. These ideas became the foundation of what is now called
graph theory. Just as they helped Euler see a simpler
solution to the puzzle, graphs now help computer scientists
solve all sorts of problems and are the basis of all sorts of
computing, from the way find the best routes, to how
computers organize data to make it easier to search etc.
36. Having done this, Euler realised that you could show it was
impossible to come up with a route by thinking about
individual nodes and the number of edges connected to
them. Any suitable route must visit every node. It must also
involve every line (as they are the bridges).
37.
38. all nodes must have an even number of edges connected
to them if there is such a route.
All the nodes on the Königsberg graph have an odd number
of edges, so there is no such tour possible.
39. City Tour Map
Starting at the hotel, plan a route
so that tourists can visit every
tourist attraction just once ending
up back at the hotel
41. The Knight’s Tour
Place the piece on square 1. By making only “knight” moves as in
chess (see below), find a series of moves so that the knight visits
every square exactly once, returning to where it started.
(Abstraction)
42.
43. A knight moves in an L-shape: one square along and
two squares up (in any direction. For example a piece
on square 1 can move to square 6, 7 or 9.
44.
45. Abstraction
Each spot is a square on the
original board. Each line show a
possible square a knight could
jump to from a square.