Download presentation
Presentation is loading. Please wait.
Published byえみ ひろもり Modified over 5 years ago
1
情報基礎B Lecture 7 Takeshi Tokuyama Tohoku University Graduate School of Information Sciences System Information Sciences Design and Analysis of Information Systems
2
COMPUTATION AND PROGRAMMING
3
Computation The world of {0, 1} AND operation OR operation
Boolean algebra Logical operation AND operation 0 × 0 = 0 × 1 = 1 × 0 = 0, 1 × 1 = 1 Series circuit OR operation 0 + 0 = 0, = = 1, = 1 Parallel circuit NOT operation NOT(0) = 1, NOT(1) = 0 NOT
4
Computation AND operation 0 × 0 = 0 × 1 = 1 × 0 = 0, 1 × 1 = 1
Series circuit Switching : relay, transistor, diode
5
Computation OR operation 0 + 0 = 0, 0 + 1 = 1 + 0 = 1, 1 + 1 = 1
Parallel circuit
6
Computation a NOT(a) NOT operation NOT(0) = 1, NOT(1) = 0
electromanget NOT(a)
7
Example of Adder a b Circuit to calculate a + b (a, b = 0 or 1)
0 + 0 = 00 1 + 0 = 01 0 + 1 = 01 1 + 1 = 10 NOT Upper Bit Lower Bit
8
Computation Model AND, OR, NOT Logical operation
Addition, subtraction, multiplication, division, comparison IF Programming model (decision tree model) Load data from storage Store data to storage
9
Program and Decision Tree
IF(B2>=90, “A”, IF(B2>=80, “B”, IF(B2>=70, “C”, IF(B2>=60, “D”, “F”)))) B2 True False A True False B True False C True False D F Computation proceeds through the tree
10
Loop SUM(A2:A100) Decision tree becomes deep Loop structure
Loop management When to stop? In Excel… By setting range A2:A100 Read a cell in column A Adder Temporal Result
11
Loop Example: SUM(A2:A100) i=2 i = i + 1 Read A(i) TRUE Adder i<100
Temporal Result i = i + 1 TRUE i<100 FALSE Output Temporal Result
12
Programming Think about an algorithm
e.g. Grading procedure Show a flowchart with decision tree and loop structure Write the algorithm in programming language Small vocabulary, easy
13
Programming Make an operation which a computer work on
Algorithm designing Logical work Coding Learning a programming language Read programs Make some change on programs Debug(Error correction)
14
Programming hints Learning programming language Follow examples
Practice makes perfect Follow examples This is a pen > This is a dog Follow good examples Learn from the mistakes This is a apple ?? I is a man ?? System will tell you mistakes Guess what is wrong: logical mind and imagination
15
Exercise Write a flowchart of program that acts same as COUNTIF(B2:B21, “A”) without using COUNTIF
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.