02-counting-systems

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

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

View Full Document Right Arrow Icon
Codes and Counting Systems CSE 110: Introduction to Computer Science
Background image of page 1

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

View Full DocumentRight Arrow Icon
There are many ways to represent information. ..
Background image of page 2
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)
Background image of page 3

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

View Full DocumentRight Arrow Icon
Morse Code Represents characters using tones of varying lengths Works over a wide range of environments
Background image of page 4
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?
Background image of page 5

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

View Full DocumentRight Arrow Icon
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
Background image of page 6
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”
Background image of page 7

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

View Full DocumentRight Arrow Icon
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
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
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
Background image of page 10
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)
Background image of page 11

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

View Full DocumentRight Arrow Icon
How About Dolphins?
Background image of page 12
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
Background image of page 13

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

View Full DocumentRight Arrow Icon
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. ..
Background image of page 14
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
Background image of page 15

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

View Full DocumentRight Arrow Icon
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
Background image of page 16
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
Background image of page 17

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

View Full DocumentRight Arrow Icon
Image of page 18
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/29/2012 for the course CSE 110 taught by Professor Shaunakpawagi during the Spring '08 term at SUNY Stony Brook.

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 Right Arrow Icon
Ask a homework question - tutors are online