0% found this document useful (0 votes)
15 views28 pages

COMP1002 - Lec2 - Number Systems

The document discusses number systems and their properties. It covers non-positional and positional number systems, and describes decimal, binary, octal and hexadecimal systems in detail. Binary numbers are explained in the context of computers using binary digits.

Uploaded by

louis425llw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views28 pages

COMP1002 - Lec2 - Number Systems

The document discusses number systems and their properties. It covers non-positional and positional number systems, and describes decimal, binary, octal and hexadecimal systems in detail. Binary numbers are explained in the context of computers using binary digits.

Uploaded by

louis425llw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

COMP1002 -

Number Systems

Lecture 2
Muhammad Tayyab
Number Systems
Number Systems
• What
• Set of symbols and rules

• Why
• Counting, measuring, performing calculations, communicating numerical
information, and facilitating logical reasoning and problem-solving

• How
Types of number systems
• Non positional
• Single symbol

• Positional
• Multiple symbols
• Value
• Digit (symbol)
• Position
• Base
Positional Number Systems
• Decimal
• Base 10
• Binary
• Base 2
• Octal
• Base 8
• Hexadecimal
• Base 16
?
Why Binary?
Sand to Silicon - https://www.youtube.com/watch?v=d9SWNLZvA8g
Binary
Decimal <--> Binary
• Decimal (Base 10)
• 0 1 2 3 4 5 6 7 8 9 10 11 12 13 …
• Binary (Base 2)
• 0 1 10 11 100 101 110 111 …
• Bit (Binary digit)
Binary <--> Decimal
• 8415
• (8 x 103) + (4 x 102) + (1 x 101) + (5 x 100)
• 8000 + 400 + 10 + 5 = (8415)10

• (101)2
• (1 x 22) + (0 x 21) + (1 x 20)
• 4 + 0 + 1 = (5)10

• 0010000011011111
• (0010000011011111)2 = (8415)10
Decimal <--> Binary
• 8415
• 8415 % 2 = 1
• 4207 % 2 = 1
• 2103 % 2 = 1
• 1051 % 2 = 1
• 525 % 2 = 1
• 262 % 2 = 0 (10000011011111)2
• 131 % 2 = 1 MSB LSB
• 65 % 2 = 1
• 32 % 2 = 0
• 16 % 2 = 0
• 8%2 = 0
• 4%2 = 0
• 2%2 = 0
• 1%2 = 1
Binary

?
Decimal <--> Octal
• 8415
• 8415 % 8 =7
• 1051 % 8 =3
• 131 % 8 =3
• 16 % 8 =0
•2%8 =2
Decimal <--> Hexadecimal
• 8415
• 8415 % 16 = 15
• 525 % 16 = 13
• 32 % 16 =0
• 2 % 16 =2
Binary and computers
1950s SAGE air defense system, which used
Binary and computers 62,500 punched cards (around 5 MB of data)
Input Process Output
Data representation

A
65
01000001
01000010 ?
• Encoding
• Text
• ASCII
• 8 bits
• Unicode
• UTF-8
• UTF-16
• UTF-32 你好
H e l l o
72 101 108 108 111

https://www.rapidtables.com/convert/number/ascii-hex-bin-dec-converter.html
Data representation
• Images
• RGB
• one byte/ channel/ pixel
• Videos
• Frames x pictures
• Voice/ Music
• Sampling
• Quantization

• Data compression
• jpg, png, tiff …
• mp4, avi, 3gp …
• mp3, aac, flac …
Input Process Output
Input Algorithm Output
Algorithms
Step by step process to achieve a target/ to reach solution
Algorithms – Example
1. Open first page
2. if that’s the page
3. Done
4. Otherwise goto next page pseudo code
5. if that’s the page
6. Done
7. Otherwise goto next page
8. if that’s the page
9. Done

Algorithms – Example
1. Open book in half
2. if that’s the page
3. Done
4. Otherwise
5. If its on the left side
6. Open left part in half
7. Otherwise
8. Open right part in half
9. if that’s the page
10. Done
11. Otherwise
12. If its on the left side
13. Open left part in half
14. Otherwise
15. Open right part in half

Algorithms – Redundancy
1. Open book in half
2. if that’s the page
3. Done
4. Otherwise
5. If its on the left side
6. Open left part in half
7. Otherwise
8. Open right part in half
9. if that’s the page
10. Done
11. Otherwise
12. If its on the left side
13. Open left part in half
14. Otherwise
15. Open right part in half

Algorithms – Loop
1. Open book in half
2. if that’s the page
3. Done
4. Otherwise
5. If its on the left side
6. Open left part in half
7. Otherwise
8. Open right part in half
9. Goto line 2
Algorithms Optimization
Step by step process to achieve a target/ to reach solution
Improve / optimize

You might also like