CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1
Announcements If this is your first class, pick up a syllabus. Recitations begin next week Make your name signs Cell phones off! 2
Today’s lessons Information encoding/decoding Examples –digital photos –mp3s –morse code –binary numbers Bit strings 3
Images 4 Each pixel encodes the amount of RED, GREEN and BLUE (RGB). This is an additive color scheme. Printing uses CYAN, MAGENTA, YELLOW and BLACK (CMYK). This is a subtractive color scheme.
Morse Code Dots, dashes and spaces used to represent letters/digits /morse2mid.phphttp:// /morse2mid.php Two features: –variable length encodings –not a prefix code 5
6 Spaces of different lengths is needed to decode unambiguously. Without spaces, how many ways can six dots in a row be decoded?
7 5 five cinq
Counting Decimal (base 10) etc. Binary (base 2) etc. 8
Bit string A ‘0’ or ‘1’ is a binary digit, or a bit. A sequence of bits is called a bit string. For example: –1101 is a bit string 9
Number systems Decimal (base 10) Each position is weighted by a power of 10. E.g. 734 = –7* *10 + 4*1 –7* * *10 0 E.g = –1* * *10 + 1*1 –1* * * *10 0 Binary (base 2) Each position is weighted by a power of 2. E.g. 111 = –1*4 + 1*2 + 1*1 = “seven” –1* * *2 0 E.g = –1*8 + 1*4 + 0*2 + 1*1 = “thirteen” –1* * * *2 0 10
Interpretation QUESTION: –What does the bit string 1101 represent? 11
Interpretation QUESTION: –What does the bit string 1101 represent? ANSWER: –Whatever we want it to represent! 12
Representations Binary (non-negative numbers) Two’s complement (integers) IEEE 754 (approx. floating point numbers) ASCII / EBCDIC / Unicode (characters) etc. 13
Questions? 14