cse adding in binary - github pages · adding in binary: one of the basic operations of a cpu &...

49
11 1 1 1 1 1111 1111111111= 512+256+128+64+32+16+8+4+2+1= 1023

Upload: others

Post on 15-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

111 1 1 1 1 1 1 1

1111111111= 512+256+128+64+32+16+8+4+2+1=

1023

Page 2: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

Adding in Binary:

One of the Basic Operations of a CPU &

A Useful Skill for a Computer Scientist

Page 3: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

• Naming things in computer science is an important skill since the

computer only understands on/off also known as 0/1 (binary digits or bits).

Page 4: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

• Recall the “Naming Game” where we used bits to uniquely name items—after more than a handful of items, it becomes

difficult to keep track of the names!

Page 5: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

Item Computer Name (using three bits)

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Page 6: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

• Binary addition is a strategy to help keep track of the uniqueness of computer names we assign to

items.

Page 7: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

The Rules of Binary Addition

Page 8: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

The Rules of Binary Addition

0 + 0 = 0

Page 9: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

The Rules of Binary Addition

0 + 0 = 00 + 1 = 1

Page 10: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

The Rules of Binary Addition

0 + 0 = 00 + 1 = 11 + 0 = 1

Page 11: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

The Rules of Binary Addition

0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 10

Page 12: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

The Rules of Binary Addition

0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 10

That last rule is strange!

Page 13: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

Let’s recall how we did regular addition in elementary school…

e.g.

Page 14: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

Page 15: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

Page 16: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

Page 17: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

3

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

Page 18: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

3

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

1

Page 19: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

3

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

1

This digit is “carried” to the next

column

Page 20: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

3

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

1

This digit is “carried” to the next

column

Page 21: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

3

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

1

4

This digit is “carried” to the next

column

Page 22: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

3

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

1

4

This digit is “carried” to the next

column

0

Page 23: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

3

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

1

4

This digit is “carried” to the next

column

0

We “imagine” this digit

Page 24: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

3

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

1

4

This digit is “carried” to the next

column

0

We “imagine” this digit

Page 25: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

3

238+ 5——-—

Let’s recall how we did regular addition in elementary school…

e.g.

Means “for example”

1

4

This digit is “carried” to the next

column

0

2We “imagine” this digit

Page 26: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

Let’s see an example of binary addition.

e.g.

Page 27: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

Let’s see an example of binary addition.

e.g.

Means “for example”

Page 28: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

Page 29: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

Page 30: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

0

Page 31: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

0

1

Page 32: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

0

1

This digit is “carried” to the next

column

Page 33: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

0

1

This digit is “carried” to the next

column

Page 34: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

0

1

1

This digit is “carried” to the next

column

Page 35: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

0

1

1

This digit is “carried” to the next

column

0

Page 36: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

0

1

1

This digit is “carried” to the next

column

0

We “imagine” this digit

Page 37: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

0

1

1

This digit is “carried” to the next

column

0

We “imagine” this digit

Page 38: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

101+ 1——-—

Let’s see an example of binary addition.

e.g.

Means “for example”

0

1

1

This digit is “carried” to the next

column

1

0

We “imagine” this digit

Page 39: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

You try one:

Page 40: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

1101+ 101———-——

You try one:

Page 41: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

1101+ 101———-——

You try one:

0

Page 42: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

1101+ 101———-——

You try one:

0

1

Page 43: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

1101+ 101———-——

You try one:

01

1

Page 44: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

1101+ 101———-——

You try one:

010

1

Page 45: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

1101+ 101———-——

You try one:

010

11

Page 46: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

1101+ 101———-——

You try one:

0100

11

Page 47: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

1101+ 101———-——

You try one:

0100

111

Page 48: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

1101+ 101———-——

You try one:

0100

1110

Page 49: cse adding in binary - GitHub Pages · Adding in Binary: One of the Basic Operations of a CPU & A Useful Skill for a Computer Scientist • Naming things in computer science is an

1101+ 101———-——

You try one:

01001

1110