{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

02-counting-systems

# 02-counting-systems - Codes and Counting Systems CSE 110...

This preview shows pages 1–18. Sign up to view the full content.

Codes and Counting Systems CSE 110: Introduction to Computer Science

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
There are many ways to represent information. ..
Codes Code: a system for transferring information among people and machines Codes let people communicate Most codes are NOT secret! They must be well-understood to allow communication Ex. sounds (speech), written symbols (text)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Morse Code Represents characters using tones of varying lengths Works over a wide range of environments
Codes and Combinations Consider a decryption table for Morse code A 1-character sequence has two choices A 2-character sequence has four choices A 3-character sequence has eight choices A 4-character sequence has 16 choices Is there any pattern?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Counting Systems Used to represent quantities We normally count in Base 10 (decimal) Ten digits: 0 1 2 3 4 5 6 7 8 9 There’s no special signifcance to these symbols, though
Overfow What happens when we reach 9? We’re out of distinct digits to use This causes us to overFow to a new position 10, 100, 1000. .. “10” = “all ±ngers extended”

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sums of Powers Each position indicates some power of the base ex. ones, tens, hundreds, thousands, etc. We can describe a number as the sum of various powers of the base Ex. 123 = 1x10 2 + 2x10 1 + 3x10 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
What About Mickey? Cartoon characters only have 4 digits on each hand They can’t count to ten like we do Their “10” (all fngers used) is only eight! Let’s design a counting system For them 8 fngers = Base 8 (octal) Each position represents a power oF 8
A Geek Joke Why do programmers always mix up Halloween and Christmas? Because OCT 31 = DEC 25 31 in octal (base 8) is equal to 25 in decimal (base 10)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Counting For Dolphins Dolphins only have two fippers They need a Base 2 (binary) system This is actually useFul For computers, too 0 = no power, 1 = power

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Counting in Binary Binary (base 2) only has two digits A “binary digit” is also called a “bit” Bits “roll over” more quickly than they do in base 10 (or another base) 0, 1, 10, 11, 100, 101, 110, 111, 1000. ..
Same Value, Different Base Base 10 Base 8 Base 2 Base 10 Base 8 Base 2 0 0 0 8 10 1000 1 1 1 9 11 1001 2 2 12 1010 3 3 13 1011 4 4 100 14 1100 5 5 101 15 1101 6 6 110 16 1110 7 7 111 17 1111

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Longer, Not Larger Changing the base doesn’t change the magnitude (value) of a number The representation for a number gets longer as the base decreases There are fewer possible symbols (digits) available for each position This means there are fewer possible combinations of symbols for a certain length
111010 (Base 2) to Base 10 1 1 1 0 1 0 x x x x x x 32 16 8 4 2 1 32 + 16 + 8 + 0 + 2 + 0 = 58 (base 10) From Any Base to Decimal Under each digit, write the power of the base that goes with that position Multiply each digit by its power of the base Add up all of these products The sum is equal to the decimal (base 10) value

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 59

02-counting-systems - Codes and Counting Systems CSE 110...

This preview shows document pages 1 - 18. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online