0% found this document useful (0 votes)
4 views36 pages

CS101 - Lecture 2

The document provides an overview of the binary system and its application in computer science, including data representation, number conversion between binary and decimal, and basic binary arithmetic operations. It also explains the concepts of bits and bytes, as well as bit rates for information transmission. Additionally, it includes practical examples and calculations related to data transmission speeds.

Uploaded by

yehootim
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)
4 views36 pages

CS101 - Lecture 2

The document provides an overview of the binary system and its application in computer science, including data representation, number conversion between binary and decimal, and basic binary arithmetic operations. It also explains the concepts of bits and bytes, as well as bit rates for information transmission. Additionally, it includes practical examples and calculations related to data transmission speeds.

Uploaded by

yehootim
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/ 36

CS101- Binary System

Zhenyu Yang

• Visiting Assistant Professor of Physics and Computer Science


• Research Assistant Professor of Medical Physics
• Assistant Director of Jiangsu Provincial University Key
(Construction) Laboratory for Smart Diagnosis and Treatment
of Lung Cancer

Fall 2025
Recap: computer science

• What is computer science?


• What is algorithm and computer programming?
Guess Game

• Randomly select a number between 1-30, DO NOT tell me

Card 1 Card 2 Card 3 Card 4 Card 5


Representing Data

• You must have seen computers do amazing things with


numbers, sounds, text, pictures, and games
❖ All these data from a computer’s eye are just “0” and “1”
Representing Data

• All the wonderful multi-media information on computers can


be represented by ON/OFF “switches” (transistor) in
computers.

binary digit 1

binary digit 0
Representing Data

• Computers are super electronic machines, use electricity for


data processing and storage, which is fast and reliable.
• Electricity can ow through switches:
❖ if the switch is on, the electricity ows; binary digit 1
❖ if the switch is o , the electricity does not ow binary digit 0

transistors transistors
fl
ff
fl
fl
Representing Data

• Computers represent data use binary system


• Binary is a mathematical number system: a way of counting.
❖ With millions of switches, we can represent a lot of information

binary digit 0

binary digit 1
Introduction to Number Base

• Normal decimal counting: 0~9 (base ten)


❖ Place value, from right to left raise by 10, 10 is the base
Introduction to Number Base

• Binary system has only two numbers: 0 and 1 (base 2)


❖ Place value, from right to left raise by 2, 2 is the base
Introduction to Number Base

• Binary system has only two numbers: 0 and 1 (base 2)


❖ Place value, from right to left raise by 2, 2 is the base
Binary to Decimal Number

• Positional Weight Summation


❖ directly summing the place value with the digit
Di erent Counting System

• A formal way to present number in di erent counting system


ff
ff
Binary to Decimal Number

• Q1: What is the decimal number for binary number 1011001?


Binary to Decimal Number

• Q1: What is the decimal number for binary number 1011001?


• Q2: Is there a faster way?
Binary to Decimal Number

• Current Decimal Value = Previous Decimal Value * 2 +


Current Binary Digit
❖ Doubling Adds Positional Weight: doubling the current decimal
value shifts its contribution one place to the left in binary,
equivalent to multiplying by 2 (e.g., 101 to 1010 when
multiplied by 2).
❖ Adding the Current Bit: adding the current binary digit
accounts for the new contribution at the least signi cant
position.

fi
Binary to Decimal Number

• Doubling Method
❖ Start with an initial value of 0.
❖ Traverse each binary digit from
left to right.
❖ For each digit
‣ double the current value
‣ add current binary digit (0 or 1)
Decimal to Binary Number

• Calculate binary number from decimal number


❖ Divide the number by 2 and record the remainder.
❖ Repeat until the quotient becomes 0.
❖ Read the remainders from bottom to top to form the binary
number.
Decimal to Binary Number

• What is the binary number for decimal number of 156?


Decimal to Binary Number

• What is the binary number for decimal number of 156?


Decimal to Binary Number

• What is the binary number for decimal number of 156?


Decimal to Binary Number

• Why it works?

1310 = 8+4+0+1 = 1*23+1*22+0*21+1*20 = 11012


=6
1310/2 = 6 reminder 1 1*22+1*21+0*20 + 1

610/2 = 3 reminder 0 1*21+1*20 + 0

310/2 = 1 reminder 1 1*20 + 1

110/2 = 0 reminder 1 1
Addition in Binary Number

Example 1 Example 2 Example 3


Addition in Binary Number

• Q3: What is the results of 11011 + 1011 in binary?


Addition in Binary Number

• Q3: What is the results of 11011 + 1011 in binary?

Answer = 1001102 = 3810


Subtraction in Binary Number
Subtraction in Binary Number

• Q3: What is the results of 101000 – 10001 in binary?

Answer = 101112 = 2310


Back to Guess Game

• Randomly select a number between 1-30, DO NOT tell me


Summary

• Binary Numbers Operation


❖ Decimal to binary
❖ Binary to decimal
❖ Binary Addition
❖ Binary subtraction
Bit and Byte

• What is bit (binary digit)?


❖ The smallest/basic unit of information in computer.
❖ have a value of either 0 or 1, and is the fundamental building
block of all digital computing and communication systems
Bit and Byte

• What is Byte?
❖ 1 Byte (1B) = 8 Bits (8b)
‣ With one bit (transistors) we can represent 0~1, with 8 bits
we can represent 0~255
‣ kilobyte (KB = 1000 bytes), megabytes (MB = 1000 KB),
gigabyte (GB = 1000 MB), terabyte (TB = 1000 GB)
❖ The most common units for document size DO NOT use 1024!
‣ Movie (~GB); Word/Pdf (~MB); Text (~KB)
Bit and Byte
Bit Rate (Info Transmission)

• Bit rate: number of bits transmitted per second


❖ Mbps: Mega bits per second
❖ Others: Kbps and Gbps
• Examples:
❖ Ethernet speed (wired transmission)
‣ Gigabit Ethernet (GbE), 2.5 Gigabit Ethernet (2.5GbE), 10
Gigabit Ethernet (10GbE)
❖ WiFi speed (wireless transmission)
‣ WiFi 5 (3.5 Gbps), WiFi 6 (9.6 Gbps), WiFi 7 (46 Gbps)
❖ 4G/5G speed (wireless transmission)
‣ 5G (10 Gbps), 4G (1 Gbps)
Bit Rate (Info Transmission)

• Bit rate: number of bits transmitted per second


❖ Mbps: Mega bits per second
❖ Others: Kbps and Gbps
• Examples:
❖ Ethernet speed (wired transmission)
‣ Gigabit Ethernet (GbE), 2.5 Gigabit Ethernet (2.5GbE), 10
Gigabit Ethernet (10GbE)
❖ WiFi speed (wireless transmission)
‣ WiFi 5 (3.5 Gbps), WiFi 6 (9.6 Gbps), WiFi 7 (46 Gbps)
❖ 4G/5G speed (wireless transmission)
‣ 5G (10 Gbps), 4G (1 Gbps)
❖ Test your own speed: https://www.speedtest.net
Bit Rate (Info Transmission)

• Bit rate: number of bits transmitted per second


❖ Mbps: Mega bits per second
❖ Others: Kbps and Gbps
• Examples:
Bit Rate (Info Transmission)

• Q1: if you have a 4K HD graduation video 1TB in your laptop


in Duke, how long does it take to transmit the le to DKU? (If
the average transmission speed between Duke and DKU is
8Mbps)
❖ Be careful about “B” & “b”

fi
Bit Rate (Info Transmission)

• Q1: if you have a 4K HD graduation video 1TB in your laptop


in Duke, how long does it take to transmit the le to DKU? (If
the average transmission speed between Duke and DKU is
8Mbps)
❖ Be careful about “B” & “b”
‣ Time = Size / Speed
‣ Size = 1TB = 1000 * 1000 MB = 1000 * 1000 * 8 Mb
‣ Time = 1000 * 1000 s =11.57 days

fi

You might also like