U20Est109 / Problem Solving Approach L N D C S E
U20Est109 / Problem Solving Approach L N D C S E
Syllabus:
L T P C Hrs
U20EST109 PROBLEM SOLVING APPROACH
3 0 0 3 45
(Common to CSE,IT,CCE)
Course Objectives
To identify the key concepts of computational thinking and problem solving.
To know the basics of algorithm and data organization.
To understand the fundamental algorithms and factoring methods.
To know the basic concepts of array and problem solving techniques.
To familiarize the concepts of text processing, pattern searching and
recursive algorithms.
Course Outcomes
After completion of the course, the students will be able to
CO1 - Explain the basic concepts of computational thinking and problem solving. (K2)
CO2 - Explain basic concepts of algorithm and data organization. (K2)
CO3 - Illustrate algorithmic solution to problem solving. (K3)
CO4 - Explain the concepts of array, merging, sorting & searching.
(K2) CO5 - Implement recursive algorithm to solve problems. (K3)
Text Books
1. David Riley and Kenny Hunt, ―Computational Thinking for Modern Problem
Solver‖, Chapman & Hall / CRC Textbooks in Computing, 2014.
2. R. G.Dromey, ―How to solve it by Computer‖, PHI, 2008.
3. Vickers Paul, ―How to Think like a Programmer: Problem Solving for the
Bewildered‖, Cengage Learning EMEA, 2008.
Reference Books
1. V. Anton Spraul, ―Think Like a Programmer: An Introduction to Creative
Problem Solving‖, Cengage
Learning EMEA, 2012.
2. Harold Abelson & Gerald Jay Sussman, ―Structure and Interpretation of
Computer Programs‖, McGraw- Hill Book Company, 1997.
3. Don McAdam, Roger Winn,‖ A Problem-Solving Approach‖, Prentice Hall Canada; 2nd
Edition.
4. Kathryn Rentz, Paula Lentz, ―A Problem-solving Approach ―, McGraw-Hill
Education, 2018.
5. Sham Tickoo ―A Problem-solving Approach‖, Delmar / Cengage Learning, 2009.
Web References
1. https://www.edx.org/learn/problem-solving
2. https://www.lynda.com/Business-Skills-tutorials/Problem-Solving-Techniques/553700-
2.html
3. https://www.classcentral.com/course/problem-solving-skills-6687
UNIT - I
INTRODUCTION (9 Hrs)
Computational Thinking - Information and Data - Converting Information into Data – Data
Capacity – Data Types and Encoding – Logic-Solving Problems – Limits of Computation –
Pseudocode and Flow Chart.
PART A (2 marks)
1. Define Computational Thinking
It represents a universally applicable attitude and skill set everyone, not just computer
scientists, should be eager to learn and use.
Apart from desktop computers, laptop computers, and tablet computers, many other of
today’s devices rely upon embedded computers. Traction control, antilock brakes, computer-
assisted parking, and even car repair all involve computers on board automobiles. Digital
cameras are little more than a computer with a lens attached and most cell phones are really just
handheld computers.
2. Define Data.
―The quantities, characters, or symbols on which operations are performed by computers
and other automatic equipment, and which may be stored or transmitted in the form of electrical
signals, records on magnetic tape or punched cards, etc.‖
Denote an encoding of information such that the information can manipulated by a
computing system.
3. Define
Information.
Information:
―Knowledge communicated concerning some particular fact, subject, or event; that
of which one is apprised or told; intelligence, news‖
Information is ―that which is obtained by the processing of data.‖
PART B (5 marks)
1. How to Convert Information into Data.
There are two different types of data: continuous and discrete.
Data is continuous if there are an infinite number of possible values for an individual
datum, whereas data is discrete if there are a finite number of possible values.
Continuous data is usually associated with measurements involving the physical or
real world, whereas discrete data is usually associated with things that can be
counted.
As an example, consider measuring the weight of an orange. Although the orange
could weigh exactly 200 grams, it might also weigh 229.3 grams or 229.31533 grams
or even 229.31533480185993 grams.
In other words, the weight of an orange is an example of continuous data since there
are an infinite number of possible values that might describe the weight of an orange.
On the other hand, consider asking your friends how many biological parents they
have who are still living.
A sequence of bits is commonly referred to as a bit string. Since the bits in the string
are able to vary in the values that they hold, some bits being 1 while other bits are 0, a
bit string is able to display a great number of different patterns.
Consider encoding all of the symbols on a keyboard; including letters, digits, and
punctuation symbols.
We would make a list of every possible keyboard symbol and then begin to associate
each symbol with a unique bit string pattern.
We might, for example, associate the letter A with the 8 bit string 01000001 and a
period with the 8 bit string 00101110.
Consider, however, a string of two lightbulbs. How many different patterns could the
string exhibit? Two of the patterns are obvious: both lightbulbs could be 0 or both
lightbulbs could be 1. Two other patterns are also possible
The four patterns that a string of two bits can exhibit are 00, 01, 10, and 11.
HaltChecker
Metaphysical Limitations
The concept that Turing proposed has become well known as the Turing test. The goal of
the Turing test is determine whether a computing system is intelligent.
Three numbers
Figure shows how the number five is represented in each of these four numeral systems:
tally marking, the Roman numeral system, the decimal system, and the binary system.
A black-and-white image could be encoded using the bits shown on the right.
Sound
Digital audio is used almost exclusively today when recording, processing, and
distributing sound.
Sound is a physical phenomenon caused by waveforms that propagate through the air.
A microphone is used to transform the waveform into an analog electric signal after
which the analog signal is sampled to produce a digital encoding.
Sampling is a process where the strength of a changing signal is measured at regular
time intervals and those measurements are then recorded.
Frequency is the rate at which sound waves change and is measured in terms of the hertz.
The hertz is denoted as Hz and is defined as the number of cycles (or changes) per
second.
Logic:
Logic, in its broadest sense, deals with correct and incorrect ways to reason.
Logic provides a way to tell the difference between incorrect and correct thinking, and
can therefore be defined as the science of correct thinking.
The study of logic can be broken into two categories:
o inductive logic
o deductive logic
Inductive logic is a type of reasoning that begins with a set of observations or experiences
from which conclusions can be derived with some degree of certainty.
Deductive logic, by contrast, begins by assuming that certain things are absolutely true
from which other facts must also be absolutely true.
A premise is a statement that is assumed to be true and that is used to justify a
conclusion.
A conclusion is a statement of truth that must logically flow from the premises.
A syllogism as a logical argument that contained two premises and a true conclusion that
must logically follow if the two premises are actually true.
Symbolic logic is a modern extension of Aristotelian logic where symbols, rather than
phrases drawn from human language, are used to represent statements of truth.
Boolean Logic:
form the basic units of Boolean logic. A proposition is a statement that can be either true
or false. Stated another way, a proposition is a statement that has a value of either true or
false.
In Boolean logic there are only two values: true and false. These two values are known as
logical values or truth values. Boolean logic does not allow for uncertainties or for
probabilities
Propositions can be either
o simple
o compound
A simple proposition is one that cannot be broken into parts.
A compound proposition is formed by combining simple propositions with logical
connectives, also known as logical operators.
There are four fundamental logical operators that are best described by the words
o and
o or
o implies
o not
Writing Well-Formed Propositions
Propositions must be well formed (i.e., properly written) to have meaning.
A well-formed logical proposition should follow specific rules.
Rule 1 - Each of the following is a simple proposition.
a. Any single letter
b. True
c. False
Rule 2—Let a box (□) stand for a proposition (either simple or compound).
Our process of reasoning will move from the simplest substructures within the entire
proposition up to the more complex propositions that comprise the whole.
Step 1- We can first apply Rule 1a to the capital letters P, Q, and R.
Step 2- By applying Rule 1a to each of the letters P, Q, and R we can rewrite the
expression as shown next.
Step 3 - We must now see if any further rules can be applied to what remains of the
expression.
Step 4- We must continue to find further rules to apply to what remains of the expression.
Step 5- We now notice that we can replace ―not □‖ with a box since ―not □‖ is
a proposition as defined by Rule 2e.
Step 6- Finally, it should be obvious that Rule 2a can be applied to complete our proof.
We can replace ―□ and □‖ with a box to yield.
The Boolean proposition “P and not (Q or R)” is shown to be well formed such that each
dotted box corresponds to some proposition that is an element of the whole.
Evaluating Propositions
When we evaluate a proposition, the goal is not to make sure that it is well written but
rather to determine the truth value of the proposition. Consider, for example, the
following simple propositions.
P = ―I am hungry.‖
Q = ―I am cold.‖
Operators that have an arity of two are known as binary operators and operators that
have an arity of one are known as unary operators.
Disjunction (OR)
Logical disjunction, however, is not as intuitive since our informal use of the word or is not
as closely connected to the way it is formally defined. We often pose two mutually exclusive
possibilities and ask which of those two possibilities actually occurred.
Implication (IMPLIES)
Logical implication is perhaps the most challenging operator to master. This
operator captures the idea that if one thing is true, then some other thing must also, by
logical necessity, be true.
Equivalence (≡)
Variables P and Q are said to be equivalent if they have the same truth value. The truth
table for logical equivalence is given in Figure
Compound Propositions
When we evaluate a proposition, the goal is to determine the truth value of the proposition.
To construct a truth table for some proposition you must do the following.
o Make a list of each logical variable (abbreviation) that appears in the proposition. If
one variable occurs more than once in the proposition, it should be included only
once in your list.
o Place a column in the truth table for every variable list your list. The column heading
should be the variable itself.
o For the heading of the last column you should write the entire proposition.
o If there are N variables in your list, you must create 2N rows. Each row represents a
unique combination of values for the N variables.
o For each row, determine the value of the proposition and place that value in the last
column.
Logical Equivalence
Two propositions are said to be equivalent if they have the same truth table. Consider, for
example, the two propositions
not (P and Q)
(not P) or (not
Q)
Two different propositions have the same truth table. These two propositions are therefore
said to be equivalent.
Tautologies and Contradictions
Any proposition that has a value of True regardless of the inputs is said to be a
tautology. Any proposition that has a value of False for all inputs is said to be a
contradiction.