ppt - faculty.uoh.edu.sa

advertisement
Discrete Structures
ICS-252
Dr. Ahmed Youssef
1
1
References
– Discrete Mathematics and its Applications
Kenneth Rosen
– Lecture Notes.
2
Discrete Structures Definition
• Discrete structure deals with discrete objects.
Discrete objects are those which are separated from
(not connected) each other.
• Examples:
• Integers (whole numbers 5, 10, 15)
• Automobiles, houses, people etc. are all discrete objects.
• On the other hand real numbers (such as 5.35, 5.2345)
are not discrete.
3
Importance of Discrete Structures
• It provides foundation material for computer science.
• It includes important material from such areas as set
theory, logic, and graph theory.
• The graph theory concepts are used in networks,
operating systems, and compilers.
• Set theory concepts are used in software engineering
and in databases.
• In engineering, It can be used to control multiproduct
batch plants, and design of a new class of simulator.
4
Representations of Integers
5
Number Theory
• It is the branch of pure mathematics concerned
with the properties of numbers in general, and
integers in particular.
Number Theory Areas:
• Elementary number theory-Study of Integers.
• Analytic number theory-employs the
machinery of calculus and complex analysis to
tackle questions about integers.
6
7
Introduction
# Computers usually use binary notation (with 2 as the
base) when carrying out arithmetic.
# Computers usually use octal (base 8) or hexadecimal
(base 16) notation when expressing characters such
as letters or digits.
# The binary digits are: 0 and 1.
# The octal digits are: 0, 1, 2, 3, 4, 5, 6, and 7.
# The decimal digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
# The hexadecimal digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B,
C, D, E and F.
8
b-base System
Decimal
System
9
b=2binary
b=8 octal
b=16  hexadecimal
Base b expansion of n
Theorem: Let b be a positive integer greater than 1. Then if
n is a positive integer, it can be expressed uniquely in the form
n = ak bk + ak-1 bk-1+…+a1 b + a0
where k is a nonnegative integer, a0, a1,…, ak are nonnegative
Integers less than b and ak ≠0 .
The base b expansion of n is denoted by:
(ak ak-1 …a1 a0)
Remarks: This theorem is used to convert the number from
any b-base to decimal-base.
10
Example : What is the decimal expansion of the hexadecimal
expansion of (2AE0B)16
Sol: we will use the expansion
n = ak bk + ak-1 bk-1+…+a1 b + a0
where b=16
(2AE0B)16 =2 x 164 + 10 x 163 + 14 x 162 + 0 x16 +11
=(175627)10
11
Example : What is the decimal expansion of the binary
expansion of (101011111)2
Sol: we will use the expansion
n = ak bk + ak-1 bk-1+…+a1 b + a0
where b=2
(101011111)2 =1 x 28 + 0 x 27 + 1 x 26 + 0 x 25 + 1 x 24 +
1 x 23 + 1 x 22 + 1 x 2 + 1 x 20
=(351)10
12
Example : Find the base 8 expansion of (12345)10
12345 = 8 x 1543 + 1
1543 = 8 x 192 + 7
192 = 8 x 24 + 0
24 = 8 x 3 + 0
3=8x0+3
(12345)10 =(30071)8
13
8
8
8
8
8
12345
1543
192
24
3
0
1
7
0
0
3
Example : Find the base 2 expansion of (241)10
(241)10 =(11110001)2
14
2
2
2
2
2
2
2
2
241
120
60
30
15
7
3
1
0
1
0
0
0
1
1
1
1
1. Convert these integers from decimal to:
binary; octal; and hexadecimal.
(a) 203
(b) 4532 (c) 97644
2. Convert these integers from base b to
decimal number.
(a) (11011)2
(b) (80E)16
(c) (7345321)8
15
To convert a binary
number to octal or
hexadecimal numbers.
16
n
Octal
Hexadecimal
0
000
0000
1
001
0001
2
010
0010
3
011
0011
4
100
0100
5
101
0101
6
110
0110
7
111
0111
8
1000
9
1001
A
1010
B
1011
C
1100
D
1101
E
1110
F
1111
Example : What is the hexadecimal expansion of the binary
expansion of (101011111)2
Sol:
(101011111)2 = (0001 0101 1111)2 =(15F) 16
Example : What is the octa expansion of the binary
expansion of (101011111)2
Sol:
(101011111)2 = (101 011 111)2 =(537)8
17
Example : What is the binary expansion of the (A10D)16
Sol:
(A10D)16 =(1010000100001101)2
Example : What is the binary expansion of (537)8
Sol:
(537)8 = (101 011 111)2
18
• Find
the
octal
and
hexadecimal
expansions of (11 1110 1011 1100)2
• Find the binary expansions of (765)8 and
(A8D)16.
19
20
Download