Lecture Note 01 - CSE4310
Lecture Note 01 - CSE4310
Lecture Note 1
2 / 11
Definitions
• Algorithm:
• A set of rules for carrying out some calculation, either by hand or, more usually,
on a machine
• A finite set of rules, which gives a sequence of operations for solving a specific
problem and satisfies the following criteria:
• Finiteness: terminate in finite time
• Definiteness: each step must be precisely defined
• Input: zero or more inputs
• Output: one or more outputs
• Effectiveness: in principle, each step should be able to be traced by humans
• Named for the nineth-century Persian mathematician al-Khowarizmi
• Algorithmics:
• The study of algorithms
3 / 11
Multiplication Algorithms
4 / 11
Multiplication Algorithms
5 / 11
Implementation
#include <iostream>
do{
if( m % 2 == 1 ){
result = result + n;
}
m = m / 2;
n = n * 2;
} while( m != 0 );
return result;
}
6 / 11
Multiplication Algorithms
7 / 11
Mathematical Notations
• ⋀ : and (conjunction)
• ⋁ : or (disjunction)
• ¬ : not (negation)
• ⟹ : implies (implication) [ 𝑝 ⇒ 𝑞 : 𝑖𝑓 𝑝, 𝑡ℎ𝑒𝑛 𝑞. ]
• ⟺ : equivalent
• ∀ : for all
• ∃ : there exist
8 / 11
Mathematical Notations
• Propositional Calculus
• ⋀ : and (conjunction)
• ⋁ : or (disjunction)
• ¬ : not (negation)
• ⟹ : implies (implication) [ 𝑝 ⇒ 𝑞 : 𝑖𝑓 𝑝, 𝑡ℎ𝑒𝑛 𝑞. ]
• ⟺ : equivalent
• ∀ : for all
• ∃ : there exist
• Set Theory
• ∪, ∩, ∅, ⊂, ⊆, ⊃, ⊇, ⊄, ⊅, 2! , 𝐴 , |
• 𝑎, 𝑏 , 𝑎, 𝑏 , 𝑎, 𝑏 , [𝑎, 𝑏)
• Sum and Product % '
C 𝑓(𝑖) , E 𝑔(𝑗)
"#$ &#$
• Miscellaneous
• 𝑥, 𝑦
9 / 11
Proof Techniques
• Contradiction
• Demonstrating the truth of a statement by proving that its negation yields a
contradiction
• Called “proof of contradiction” or “indirect proof”
• Example Statements:
• 2 𝑖𝑠 𝑎 𝑖𝑟𝑟𝑎𝑡𝑖𝑜𝑛𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟.
• 𝑇ℎ𝑒𝑟𝑒 𝑎𝑟𝑒 𝑖𝑛𝑓𝑖𝑛𝑖𝑡𝑒𝑙𝑦 𝑚𝑎𝑛𝑦 𝑝𝑟𝑖𝑚𝑒 𝑛𝑢𝑚𝑏𝑒𝑟𝑠.
10 / 11
Proof Techniques
• Mathematical Induction
• Reasoning
• Induction: it remains possible that the general rule induced is wrong
• Deduction: deductive reasoning may yield a wrong result
• Principle
• Assume 𝑃 is a property of the integers and an integer 𝑎, known as the basis
• Step 1: Show that 𝑃 𝑎 ℎ𝑜𝑙𝑑𝑠
• Step 2: Show that 𝑃 𝑛 𝑚𝑢𝑠𝑡 ℎ𝑜𝑙𝑑 𝑤ℎ𝑒𝑛𝑒𝑣𝑒𝑟 𝑃 𝑛 − 1 ℎ𝑜𝑙𝑑𝑠, 𝑓𝑜𝑟 𝑛 > 𝑎
• Example Statements
' '
𝑛(𝑛 + 1) 𝑛(𝑛 + 1)(2𝑛 + 1)
C𝑖 = , C 𝑖( =
2 6
"#$ "#$
11 / 11