channel: 41 session: cs2420 HUFFMAN CODING
|
|
- Adela Taylor
- 7 years ago
- Views:
Transcription
1 channel: 41 session: cs2420 HUFFMAN CODING cs2420 Introduction to Algorithms and Data Structures Fall
2 channel: 41 session: cs2420 administrivia 2
3 channel: 41 session: cs2420 -assignment 11 due tonight -assignment 12 out -assignment 13 (final project) requires a partner 3
4 last time 4
5 min-max heap 5
6
7 1 min
8 1 min max
9 1 min max min
10 1 min max min max 6
11 -a min-max heap further extends the heap order property -for any node E at even depth, E is the minimum element in its subtree -for any node O at odd depth, O is the maximum element in its subtree -the root is considered to be at even depth (zero) 7
12 today 8
13 -file compression -data compression -data decompression -Huffman s algorithm 9
14 file compression 10
15 -why do we care about file compression? -reducing traffic on networks and the internet -reducing disk space requirements -various media formats -MP3 -MPEG4 -JPEG - -YouTube, Netflix, GoogleMaps, etc. would not be possible without compression 11
16 exercise -suppose we the following string stored in a text file: ddddddddddddabc -how many bytes of disk space does it take to store these 15 characters using ASCII? 12
17 binary -each bit represents power of on off off on off off on on -sum up all the bits that are on = 147 -how can we convert the other way? 13
18 what is the binary representation of the number 39? A) B) C) D)
19 There are 10 types of people in the world: those who understand binary, and those who don t. 15
20 -all data in a computer is stored in binary -a bit is a binary digit -a byte is an 8-bit value -common unit of data in a computer -bytes
21 how many different values can 4 bits hold? A) 7 B) 8 C) 15 D) 16 E) 31 F) 32 17
22 ASCII -each character corresponds to one byte -remember, a byte is just an 8-bit number! (0-255) -for example: = 32 = (blank space) = 59 = ; = 65 = A = 66 = B 18
23 -a simple file containing the text Hello is stored on the disk as: the text editor knows to treat each byte as an ASCII value -in reality, they are just bytes 19
24 exercise -suppose we the following string stored in a text file: ddddddddddddabc -how many bytes of disk space does it take to store these 15 characters using ASCII? -is there any way to represent this file in fewer bytes? -hint: take advantage of repeated characters 20
25 data compression 21
26 -allow number of bits for each character to vary, instead of using the full 8 for every character -represent common characters with fewer bits, represent rare characters like q and z with more bits -with ASCII we know each char is 8 bits -how do we reproduce (decompress) original file if characters are of varying lengths? 22
27 -for example: - e may be the two-bit value 11 - a may be the two-bit value 00 - q may be the four-bit value z may be the four-bit value what characters does the following file contain? is there any way to know? -we must include the secret decoder ring with the compressed file 23
28 binary trie -no, I did not misspell it! -a binary trie is a binary tree in which a left branch represents a 0 and a right branch represents a 1 c d a: 000 -the path to a node represents its encoding a b b: 001 c: 01 d: 1 24
29 ddddddddddddabc d takes 15 bytes (120 bits) in ASCII c a: 000 b: is a b c: 01 d: 1 less than 3 bytes (20 bits) why is the d near the top of the tree? 25
30 data decompression 26
31 -read the bits of the compressed file one at a time on 0 go left, on 1 go right d -when a leaf node is reached, print char contained in node -start back at the root for the next bit a b c a: 000 b: 001 c: 01 d: 1 27
32 -what does the following bitstring encode? d -how many bytes is this encoded in? what if it was in ASCII? a b c a: 000 b: 001 c: 01 d: 1 28
33 what string do these bits encode? A) low B) wow C) wool D) were o l r w H d e 29
34 (re)building the compression tree 30
35 -the compressed file now contains non-ascii, varying length bytes -decompression needs the same tree in order to decode -must add header information that describes the tree -this header should not be compressed! -we will get there in a bit 31
36 building the compression tree 32
37 hello world -count the frequency of each different character h = 1 e = 1 l = 3 o = 2 = 1 w = 1 r = 1 d = 1 -construct a binary trie with highest frequency characters near the top, lowest near the bottom 33
38 start with a separate tree for each character each tree is a single root node, holding the character and its frequency :1 h:1 d:1 e:1 r:1 w:1 o:2 l:3 hello world 34
39 merge the two lowest weight trees together into one new tree make a new parent node with their combined weight; smaller node on the left, larger on the right lots of ties here! h, e, w, r, d, and need a tie-breaker... more on this later... :1 h:1 d:1 e:1 r:1 w:1 o:2 l:3 hello world 35
40 remove and h trees from the list add new merged tree to the list note: non-leaf nodes don t have a character, only a weight 2 :1 h:1 d:1 e:1 r:1 w:1 o:2 l:3 hello world 36
41 continue process of merging two smallest trees which is next? 2 2 :1 h:1 d:1 e:1 r:1 w:1 o:2 l:3 hello world 37
42 continue process of merging two smallest trees which is next? :1 h:1 d:1 e:1 r:1 w:1 o:2 l:3 hello world 38
43 continue process of merging two smallest trees which is next? :1 h:1 d:1 e:1 r:1 w:1 o:2 l:3 hello world 39
44 continue process of merging two smallest trees which is next? o:2 2 :1 h:1 d:1 e:1 r:1 w:1 l:3 hello world 40
45 continue process of merging two smallest trees which is next? 7 l: o:2 2 :1 h:1 d:1 e:1 r:1 w:1 hello world 41
46 done! o:2 2 l:3 4 r:1 w:1 2 2 :1 h:1 d:1 e:1 hello world 42
47 new character encoding h: 1101 e: l : 10 o: :1100 w: 011 r : 010 o:2 2 l:3 4 d: 1110 r:1 w:1 2 2 :1 h:1 d:1 e:1 hello world
48 Huffman s algorithm 44
49 -idea is to encode most frequent characters with fewest bits -use a binary trie -common characters will be near the top of the tree -uncommon near the bottom -every file has a different frequency of characters, and therefore a different compression tree 45
50 1. count occurrences of each character in a string 2. for each character, create a leaf node to store the character and count (ie. weight) 3. place each leaf node into a priority queue 4. construct the binary trie 5. write header with binary trie information 6. compress string using character codes 46
51 1. count occurrences of each character in a string 2. for each character, create a leaf node to store the character and count (ie. weight) 3. place each leaf node into a priority queue 4. construct the binary trie 5. write header with binary trie information 6. compress string using character codes 46
52 I heart data. 47
53 I heart data. character frequency I 1 2 h 1 e 1 a 3 r 1 t 2 d
54 1. count occurrences of each character in a string 2. for each character, create a leaf node to store the character and count (ie. weight) 3. place each leaf node into a priority queue 4. construct the binary trie 5. write header with binary trie information 6. compress string using character codes 49
55 I heart data. character frequency I 1 2 h 1 I:1 :2 h:1 e:1 e 1 a 3 r 1 a:3 r:1 t:2 d:1.:1 t 2 d
56 -but, let s think about what happens when we write our compressed codes -files must be a whole number of bytes -but, the length of our compressed string will not necessarily be a factor of 8 -what do we do? 51
57 -to solve this, we add a special EOF leaf node EOF:1 -then, if we encounter this during decompression, we know we are done -and we ignore the remaining bits 52
58 I heart data. character frequency I 1 2 h 1 I:1 :2 h:1 e:1 e 1 a 3 a:3 r:1 t:2 d:1 r 1 t 2 d 1. 1 EOF 1.:1 EOF:1 53
59 1. count occurrences of each character in a string 2. for each character, create a leaf node to store the character and count (ie. weight) 3. place each leaf node into a priority queue 4. construct the binary trie 5. write header with binary trie information 6. compress string using character codes 54
60 -how do we determine the highest priority? -what happens if two nodes have the same priority? -need a tie-breaker! -use ASCII value for character to break tie -lowest values have highest priority 55
61 I heart data. I:1 :2 h:1 e:1 a:3 r:1 t:2 d:1.:1 EOF:1 PQ: 56
62 I heart data. :2 a:3 t:2 I:1 h:1 e:1 r:1 d:1.:1 EOF:1 PQ: 57
63 I heart data. character frequency ASCII I h 1 72 e a 3 97 r t d EOF
64 I heart data. :2 a:3 t:2 I:1 h:1 e:1 r:1 d:1.:1 EOF: PQ: 59
65 I heart data. :2 a:3 t:2 I:1 h:1 e:1 r:1 d:1.:1 EOF: PQ: 60
66 I heart data. :2 a:3 t:2 I:1 h:1 e:1 r:1 d:1.:1 EOF: PQ: 61
67 I heart data. :2 a:3 t:2 I:1 h:1 e:1 r:1 d:1.: PQ: EOF:1 62
68 I heart data. :2 a:3 t:2 I:1 h:1 e:1 r:1 d: PQ: EOF:1.:1 63
69 I heart data. :2 a:3 t:2 h:1 e:1 r:1 d: PQ: EOF:1.:1 I:1 64
70 I heart data. :2 a:3 t:2 h:1 e:1 r: PQ: EOF:1.:1 I:1 d:1 65
71 I heart data. :2 a:3 t:2 h:1 r: PQ: EOF:1.:1 I:1 d:1 e:1 66
72 I heart data. :2 a:3 t:2 r:1 114 PQ: EOF:1.:1 I:1 d:1 e:1 h:1 67
73 I heart data. :2 a:3 t:2 PQ: EOF:1.:1 I:1 d:1 e:1 h:1 r:1 68
74 I heart data. a:3 :2 t: PQ: EOF:1.:1 I:1 d:1 e:1 h:1 r:1 69
75 I heart data. a:3 t:2 116 PQ: EOF:1.:1 I:1 d:1 e:1 h:1 r:1 :2 70
76 I heart data. a:3 PQ: EOF:1.:1 I:1 d:1 e:1 h:1 r:1 :2 t:2 71
77 I heart data. PQ: EOF:1.:1 I:1 d:1 e:1 h:1 r:1 :2 t:2 a:3 72
78 1. count occurrences of each character in a string 2. for each character, create a leaf node to store the character and count (ie. weight) 3. place each leaf node into a priority queue 4. construct the binary trie 5. write header with binary trie information 6. compress string using character codes 73
79 -merge the two lowest weight trees together -make a new parent node with their combined weight -reinsert new tree back into the queue -but, what about ties? -when trees have more than one node, break the tie with the ASCII value of the leftmost character 74
80 I heart data. PQ: EOF:1.:1 I:1 d:1 e:1 h:1 r:1 :2 t:2 a:3 where are the two lowest weight trees? 75
81 I heart data. PQ: EOF:1.:1 I:1 d:1 e:1 h:1 r:1 :2 t:2 a:3 where are the two lowest weight trees? 76
82 I heart data. PQ: I:1 d:1 e:1 h:1 r:1 :2 t:2 a:3 2 EOF:1.:1 77
83 I heart data. PQ: I:1 d:1 e:1 h:1 r:1 :2 t:2 a:3 2 EOF:1.:1 where do we insert this new tree? 78
84 I heart data. PQ: I:1 d:1 e:1 h:1 r:1 :2 t:2 a: EOF:1 0.:1 where do we insert this new tree? 79
85 I heart data. PQ: I:1 d:1 e:1 h:1 r:1 2 :2 t:2 a:3 EOF:1.:1 80
86 I heart data. PQ: I:1 d:1 e:1 h:1 r:1 2 :2 t:2 a:3 EOF:1.:1 AND repeat 81
87 I heart data. PQ: e:1 h:1 r:1 2 :2 t:2 a:3 2 EOF:1.:1 I:1 d:1 82
88 I heart data. PQ: e:1 h:1 r:1 2 :2 2 t:2 a:3 EOF:1.:1 I:1 d:1 83
89 I heart data. PQ: r:1 2 :2 2 t:2 a:3 EOF:1.:1 I:1 d:1 2 e:1 h:1 84
90 I heart data. PQ: r:1 2 :2 2 2 t:2 a:3 EOF:1.:1 I:1 d:1 e:1 h:1 85
91 I heart data. PQ: :2 2 2 t:2 a:3 I:1 d:1 e:1 h:1 r:1 2 EOF:1.:1 86
92 I heart data. PQ: :2 2 2 t:2 a:3 I:1 d:1 e:1 h:1 3 r:1 2 EOF:1.:1 87
93 I heart data. PQ: :2 2 2 t:2 a:3 3 I:1 d:1 e:1 h:1 r:1 2 EOF:1.:1 88
94 I heart data. PQ: 2 t:2 a:3 3 e:1 h:1 r:1 2 EOF:1.:1 :2 2 I:1 d:1 89
95 I heart data. PQ: 2 t:2 a:3 3 e:1 h:1 r:1 2 EOF:1.:1 4 :2 2 I:1 d:1 90
96 I heart data. PQ: 2 t:2 a:3 3 4 e:1 h:1 r:1 2 :2 2 EOF:1.:1 I:1 d:1 91
97 I heart data. PQ: a:3 3 4 r:1 2 :2 2 EOF:1.:1 I:1 d:1 4 2 t:2 e:1 h:1 92
98 I heart data. PQ: a: r:1 2 :2 2 2 t:2 EOF:1.:1 I:1 d:1 e:1 h:1 93
99 I heart data. PQ: 4 4 :2 2 2 t:2 I:1 d:1 e:1 h:1 6 a:3 3 r:1 2 EOF:1.:1 94
100 I heart data. PQ: :2 2 2 t:2 a:3 3 I:1 d:1 e:1 h:1 r:1 2 EOF:1.:1 95
101 I heart data. PQ: 6 a:3 3 r:1 2 EOF:1.: :2 2 2 t:2 I:1 d:1 e:1 h:1 96
102 I heart data. PQ: 6 8 a: r:1 2 :2 2 2 t:2 EOF:1.:1 I:1 d:1 e:1 h:1 97
103 I heart data a: r:1 2 :2 2 2 t:2 EOF:1.:1 I:1 d:1 e:1 h:1 98
104 while PQ contains at least two nodes { dequeue two trees,l and R node I = new internal node I.left = L I.right = R I.weight = L.weight + R.weight } PQ.enqueue(I) //PQ contains only one node root = PQ.dequeue() 99
105 1. count occurrences of each character in a string 2. for each character, create a leaf node to store the character and count (ie. weight) 3. place each leaf node into a priority queue 4. construct the binary trie 5. write header with binary trie information 6. compress string using character codes 100
106 -the compressed files needs info to be able to rebuild the same compression tree -we call this the header -what information do we need to store to reconstruct the compression tree? 101
107 1. store character frequencies -for every character -for only non-zero characters must store pair 2. use a standardized letter frequency -use the same standard for compression and decompression 3. store the tree using a pre-order traversal -more complex, but smallest 102
108 -storing character frequencies -write each character, followed by the frequency -characters are 1 byte, integers are 4 bytes -so, each character will require 5 bytes to write -how do we mark the end of the header (and beginning of the compressed string)? -write out null and 0 -NOTE: we are going to write out our file as hex 103
109 hexadecimal -hexadecimal is the base-16 number system -we only have 10 digits (0-9), so to use a number base greater than 10 we need more symbols -in hex, we use the letters A through F -A represents the value ten -F represents the value fifteen 104
110 counting -in binary, we reset and add a digit at 1 -in decimal, we reset and add a digit at 9 -in hex, we reset and add a digit at F (ie. 15) 8 9 A B C D E F 10 (= sixteen) 11 (= seventeen) 105
111 -each decimal place represents a power of 16 1AF = (1 * 16 2 ) + (A * 16 1 ) + (F * 16 0 ) = =
112 -hex is useful because each hex digit corresponds to one half-byte (ie. 4 bits) -reading raw byte data is almost always done in hex -two hex digits makes up a single byte -bytes in hex: 1A FF D5 107
113 hex to binary -each hex digit is a specific 4-bit sequence 0 = = 0001 E = 1110 F = converting from hex to binary is as simple as representing each digit with its bit-sequence 12 EF = a single byte is two hex digits -the bytes in the above are 12 and EF 108
114 what is the hex value of these 8 bits? A) B2 B) A2 C) 12 D)
115 I heart data. character hex value frequency I h 68 1 e 65 1 a 61 3 r E t 74 2 d E 1 EOF
116 1. count occurrences of each character in a string 2. for each character, create a leaf node to store the character and count (ie. weight) 3. place each leaf node into a priority queue 4. construct the binary trie 5. write header with binary trie information 6. compress string using character codes 111
117 I heart data a: r:1 2 :2 2 2 t:2 EOF:1.:1 I:1 d:1 e:1 h:1 112
118 -want to create a look-up table to quickly convert from character to bit code -what data structure can we use for this? 113
119 I heart data. character hex value bit-code I h e a r t d E 0111 EOF
120 I heart data. character hex value bit-code I h e a r t d E 0111 EOF
121 I heart data. character hex value bit-code I h e a r t d E 0111 EOF
122 I heart data. character hex value bit-code I h e a r t d E 0111 EOF
123 I heart data. character hex value bit-code I h e a r t d E 0111 EOF
124 I heart data. character hex value bit-code I h e a r t d E 0111 EOF
125 I heart data. character hex value bit-code I h e a r t d E 0111 EOF
126 I heart data. character hex value bit-code I h e a r t d E 0111 EOF
127 I heart data. character hex value bit-code I h e a r now what? t d E 0111 EOF
128 I heart data. character hex value bit-code I h e a r t d E 0111 EOF
129 I heart data. character hex value bit-code I h e a r are we done? t d E 0111 EOF
130 I heart data. character hex value bit-code I h e a r t d E 0111 EOF
131 I heart data. character hex value bit-code I h e a r now, convert to hex t d E 0111 EOF
132 I heart data. character hex value bit-code I h e a r t d now, convert to hex A9 B8 2F 29 E3 B0. 2E 0111 EOF
133 I heart data. character hex value bit-code I h e E A9 B8 2F 29 E3 B0 a r t d E 0111 EOF
134 I heart data. character hex value bit-code I h e a r t d E E A9 B8 2F 29 E3 B0 we just went from 13 bytes to 61 bytes. why should we care about this???? EOF
135 decompression 130
136 what steps do I need to take to decompress this file? E A9 B8 2F 29 E3 B0 131
137 next time 132
138 -reading -chapter 12 in book -homework -assignment 11 due tonight 133
Class Notes CS 3137. 1 Creating and Using a Huffman Code. Ref: Weiss, page 433
Class Notes CS 3137 1 Creating and Using a Huffman Code. Ref: Weiss, page 433 1. FIXED LENGTH CODES: Codes are used to transmit characters over data links. You are probably aware of the ASCII code, a fixed-length
More informationBinary Trees and Huffman Encoding Binary Search Trees
Binary Trees and Huffman Encoding Binary Search Trees Computer Science E119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Motivation: Maintaining a Sorted Collection of Data A data dictionary
More informationSection 1.4 Place Value Systems of Numeration in Other Bases
Section.4 Place Value Systems of Numeration in Other Bases Other Bases The Hindu-Arabic system that is used in most of the world today is a positional value system with a base of ten. The simplest reason
More informationChapter 4: Computer Codes
Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data
More informationToday s topics. Digital Computers. More on binary. Binary Digits (Bits)
Today s topics! Binary Numbers! Brookshear.-.! Slides from Prof. Marti Hearst of UC Berkeley SIMS! Upcoming! Networks Interactive Introduction to Graph Theory http://www.utm.edu/cgi-bin/caldwell/tutor/departments/math/graph/intro
More informationBinary Heaps * * * * * * * / / \ / \ / \ / \ / \ * * * * * * * * * * * / / \ / \ / / \ / \ * * * * * * * * * *
Binary Heaps A binary heap is another data structure. It implements a priority queue. Priority Queue has the following operations: isempty add (with priority) remove (highest priority) peek (at highest
More informationBase Conversion written by Cathy Saxton
Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,
More informationComputer Science 281 Binary and Hexadecimal Review
Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two
More informationencoding compression encryption
encoding compression encryption ASCII utf-8 utf-16 zip mpeg jpeg AES RSA diffie-hellman Expressing characters... ASCII and Unicode, conventions of how characters are expressed in bits. ASCII (7 bits) -
More informationInternational Journal of Advanced Research in Computer Science and Software Engineering
Volume 3, Issue 7, July 23 ISSN: 2277 28X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com Greedy Algorithm:
More informationInformation, Entropy, and Coding
Chapter 8 Information, Entropy, and Coding 8. The Need for Data Compression To motivate the material in this chapter, we first consider various data sources and some estimates for the amount of data associated
More informationDecimal to Binary Conversion
Decimal to Binary Conversion A tool that makes the conversion of decimal values to binary values simple is the following table. The first row is created by counting right to left from one to eight, for
More informationThe following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).
CHAPTER 5 The Tree Data Model There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that models hierarchical
More informationCSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.
Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure
More informationImage Compression through DCT and Huffman Coding Technique
International Journal of Current Engineering and Technology E-ISSN 2277 4106, P-ISSN 2347 5161 2015 INPRESSCO, All Rights Reserved Available at http://inpressco.com/category/ijcet Research Article Rahul
More informationNumber Representation
Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data
More information10CS35: Data Structures Using C
CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a
More informationEE 261 Introduction to Logic Circuits. Module #2 Number Systems
EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook
More informationUseful Number Systems
Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2
More informationConverting a Number from Decimal to Binary
Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive
More informationBinary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R
Binary Search Trees A Generic Tree Nodes in a binary search tree ( B-S-T) are of the form P parent Key A Satellite data L R B C D E F G H I J The B-S-T has a root node which is the only node whose parent
More informationStoring Measurement Data
Storing Measurement Data File I/O records or reads data in a file. A typical file I/O operation involves the following process. 1. Create or open a file. Indicate where an existing file resides or where
More informationPhysical Data Organization
Physical Data Organization Database design using logical model of the database - appropriate level for users to focus on - user independence from implementation details Performance - other major factor
More informationCyber Security Workshop Encryption Reference Manual
Cyber Security Workshop Encryption Reference Manual May 2015 Basic Concepts in Encoding and Encryption Binary Encoding Examples Encryption Cipher Examples 1 P a g e Encoding Concepts Binary Encoding Basics
More informationCS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011
CS101 Lecture 11: Number Systems and Binary Numbers Aaron Stevens 14 February 2011 1 2 1 3!!! MATH WARNING!!! TODAY S LECTURE CONTAINS TRACE AMOUNTS OF ARITHMETIC AND ALGEBRA PLEASE BE ADVISED THAT CALCULTORS
More informationPositional Numbering System
APPENDIX B Positional Numbering System A positional numbering system uses a set of symbols. The value that each symbol represents, however, depends on its face value and its place value, the value associated
More information1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++
Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The
More informationHOMEWORK # 2 SOLUTIO
HOMEWORK # 2 SOLUTIO Problem 1 (2 points) a. There are 313 characters in the Tamil language. If every character is to be encoded into a unique bit pattern, what is the minimum number of bits required to
More informationBinary Heaps. CSE 373 Data Structures
Binary Heaps CSE Data Structures Readings Chapter Section. Binary Heaps BST implementation of a Priority Queue Worst case (degenerate tree) FindMin, DeleteMin and Insert (k) are all O(n) Best case (completely
More informationLecture 2. Binary and Hexadecimal Numbers
Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations
More informationIntel Hexadecimal Object File Format Specification Revision A, 1/6/88
Intel Hexadecimal Object File Format Specification Revision A, 1/6/88 DISCLAIMER Intel makes no representation or warranties with respect to the contents hereof and specifically disclaims any implied warranties
More informationChapter 2. Binary Values and Number Systems
Chapter 2 Binary Values and Number Systems Numbers Natural numbers, a.k.a. positive integers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative numbers A
More informationKrishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C
Tutorial#1 Q 1:- Explain the terms data, elementary item, entity, primary key, domain, attribute and information? Also give examples in support of your answer? Q 2:- What is a Data Type? Differentiate
More informationplc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums
plc numbers - 3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;
More informationThe Hexadecimal Number System and Memory Addressing
APPENDIX C The Hexadecimal Number System and Memory Addressing U nderstanding the number system and the coding system that computers use to store data and communicate with each other is fundamental to
More informationDigital codes. Resources and methods for learning about these subjects (list a few here, in preparation for your research):
Digital codes This worksheet and all related files are licensed under the Creative Commons Attribution License, version 1.0. To view a copy of this license, visit http://creativecommons.org/licenses/by/1.0/,
More informationDigital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture
More informationFrom Last Time: Remove (Delete) Operation
CSE 32 Lecture : More on Search Trees Today s Topics: Lazy Operations Run Time Analysis of Binary Search Tree Operations Balanced Search Trees AVL Trees and Rotations Covered in Chapter of the text From
More information2011, The McGraw-Hill Companies, Inc. Chapter 3
Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through
More informationStreaming Lossless Data Compression Algorithm (SLDC)
Standard ECMA-321 June 2001 Standardizing Information and Communication Systems Streaming Lossless Data Compression Algorithm (SLDC) Phone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: http://www.ecma.ch
More information6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10
Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you
More informationOperations: search;; min;; max;; predecessor;; successor. Time O(h) with h height of the tree (more on later).
Binary search tree Operations: search;; min;; max;; predecessor;; successor. Time O(h) with h height of the tree (more on later). Data strutcure fields usually include for a given node x, the following
More informationSystems I: Computer Organization and Architecture
Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x
More informationCS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions
CS 2112 Spring 2014 Assignment 3 Data Structures and Web Filtering Due: March 4, 2014 11:59 PM Implementing spam blacklists and web filters requires matching candidate domain names and URLs very rapidly
More informationwinhex Disk Editor, RAM Editor PRESENTED BY: OMAR ZYADAT and LOAI HATTAR
winhex Disk Editor, RAM Editor PRESENTED BY: OMAR ZYADAT and LOAI HATTAR Supervised by : Dr. Lo'ai Tawalbeh New York Institute of Technology (NYIT)-Jordan X-Ways Software Technology AG is a stock corporation
More informationLossless Grey-scale Image Compression using Source Symbols Reduction and Huffman Coding
Lossless Grey-scale Image Compression using Source Symbols Reduction and Huffman Coding C. SARAVANAN cs@cc.nitdgp.ac.in Assistant Professor, Computer Centre, National Institute of Technology, Durgapur,WestBengal,
More informationHexadecimal Object File Format Specification
Hexadecimal Object File Format Specification Revision A January 6, 1988 This specification is provided "as is" with no warranties whatsoever, including any warranty of merchantability, noninfringement,
More informationArithmetic Coding: Introduction
Data Compression Arithmetic coding Arithmetic Coding: Introduction Allows using fractional parts of bits!! Used in PPM, JPEG/MPEG (as option), Bzip More time costly than Huffman, but integer implementation
More informationCounting in base 10, 2 and 16
Counting in base 10, 2 and 16 1. Binary Numbers A super-important fact: (Nearly all) Computers store all information in the form of binary numbers. Numbers, characters, images, music files --- all of these
More informationCSI 333 Lecture 1 Number Systems
CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...
More informationBinary Representation
Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must tbe able to handle more than just values for real world problems
More informationThe Answer to the 14 Most Frequently Asked Modbus Questions
Modbus Frequently Asked Questions WP-34-REV0-0609-1/7 The Answer to the 14 Most Frequently Asked Modbus Questions Exactly what is Modbus? Modbus is an open serial communications protocol widely used in
More information1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier.
Study Group 1 Variables and Types 1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier. 2. What does the byte 00100110 represent? 3. What is the purpose of the declarations
More informationData Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:
Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how
More informationTHE SECURITY AND PRIVACY ISSUES OF RFID SYSTEM
THE SECURITY AND PRIVACY ISSUES OF RFID SYSTEM Iuon Chang Lin Department of Management Information Systems, National Chung Hsing University, Taiwan, Department of Photonics and Communication Engineering,
More informationSolution for Homework 2
Solution for Homework 2 Problem 1 a. What is the minimum number of bits that are required to uniquely represent the characters of English alphabet? (Consider upper case characters alone) The number of
More information2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:
2 Number Systems 2.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish
More informationCS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team
CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team Lecture Summary In this lecture, we learned about the ADT Priority Queue. A
More informationroot node level: internal node edge leaf node CS@VT Data Structures & Algorithms 2000-2009 McQuain
inary Trees 1 A binary tree is either empty, or it consists of a node called the root together with two binary trees called the left subtree and the right subtree of the root, which are disjoint from each
More informationLSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology
LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3
More informationENGINEERING COMMITTEE Digital Video Subcommittee SCTE 20 2012 METHODS FOR CARRIAGE OF CEA-608 CLOSED CAPTIONS AND NON-REAL TIME SAMPLED VIDEO
ENGINEERING COMMITTEE Digital Video Subcommittee SCTE 20 2012 METHODS FOR CARRIAGE OF CEA-608 CLOSED CAPTIONS AND NON-REAL TIME SAMPLED VIDEO NOTICE The Society of Cable Telecommunications Engineers (SCTE)
More informationThird Southern African Regional ACM Collegiate Programming Competition. Sponsored by IBM. Problem Set
Problem Set Problem 1 Red Balloon Stockbroker Grapevine Stockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers
More informationPES Institute of Technology-BSC QUESTION BANK
PES Institute of Technology-BSC Faculty: Mrs. R.Bharathi CS35: Data Structures Using C QUESTION BANK UNIT I -BASIC CONCEPTS 1. What is an ADT? Briefly explain the categories that classify the functions
More informationBinary Heap Algorithms
CS Data Structures and Algorithms Lecture Slides Wednesday, April 5, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org 2005 2009 Glenn G. Chappell
More informationNumeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:
Numeral Systems Which number is larger? 25 8 We need to distinguish between numbers and the symbols that represent them, called numerals. The number 25 is larger than 8, but the numeral 8 above is larger
More informationLecture 11: Number Systems
Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number
More informationBinary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.
Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems
More informationMAC Sublayer. Abusayeed Saifullah. CS 5600 Computer Networks. These slides are adapted from Kurose and Ross
MAC Sublayer Abusayeed Saifullah CS 5600 Computer Networks These slides are adapted from Kurose and Ross Collision-Free Protocols v N Stations v Each programmed with a unique address: 0-(N-1). v Propagation
More informationCompression techniques
Compression techniques David Bařina February 22, 2013 David Bařina Compression techniques February 22, 2013 1 / 37 Contents 1 Terminology 2 Simple techniques 3 Entropy coding 4 Dictionary methods 5 Conclusion
More informationSimple Image File Formats
Chapter 2 Simple Image File Formats 2.1 Introduction The purpose of this lecture is to acquaint you with the simplest ideas in image file format design, and to get you ready for this week s assignment
More informationBinary, Hexadecimal, Octal, and BCD Numbers
23CH_PHCalter_TMSETE_949118 23/2/2007 1:37 PM Page 1 Binary, Hexadecimal, Octal, and BCD Numbers OBJECTIVES When you have completed this chapter, you should be able to: Convert between binary and decimal
More informationOct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8
ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also
More informationND48-RS ASCII A2.04 Communication Protocol
ND48-RS ASCII A2.04 Communication Protocol SEM 06.2003 Str. 1/6 ND48-RS ASCII A2.04 Communication Protocol ASCII A2.04 protocol provides serial communication with most of the measurement and control devices
More informationASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters
The char Type ASCII Encoding The C char type stores small integers. It is usually 8 bits. char variables guaranteed to be able to hold integers 0.. +127. char variables mostly used to store characters
More information1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.
1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D. base address 2. The memory address of fifth element of an array can be calculated
More informationEverything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6
Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6 Number Systems No course on programming would be complete without a discussion of the Hexadecimal (Hex) number
More informationNUMBER SYSTEMS. William Stallings
NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html
More information6 March 2007 1. Array Implementation of Binary Trees
Heaps CSE 0 Winter 00 March 00 1 Array Implementation of Binary Trees Each node v is stored at index i defined as follows: If v is the root, i = 1 The left child of v is in position i The right child of
More informationThe use of binary codes to represent characters
The use of binary codes to represent characters Teacher s Notes Lesson Plan x Length 60 mins Specification Link 2.1.4/hi Character Learning objective (a) Explain the use of binary codes to represent characters
More informationCSE 326: Data Structures B-Trees and B+ Trees
Announcements (4//08) CSE 26: Data Structures B-Trees and B+ Trees Brian Curless Spring 2008 Midterm on Friday Special office hour: 4:-5: Thursday in Jaech Gallery (6 th floor of CSE building) This is
More informationPackage PKI. July 28, 2015
Version 0.1-3 Package PKI July 28, 2015 Title Public Key Infrastucture for R Based on the X.509 Standard Author Maintainer Depends R (>= 2.9.0),
More informationSample Questions Csci 1112 A. Bellaachia
Sample Questions Csci 1112 A. Bellaachia Important Series : o S( N) 1 2 N N i N(1 N) / 2 i 1 o Sum of squares: N 2 N( N 1)(2N 1) N i for large N i 1 6 o Sum of exponents: N k 1 k N i for large N and k
More informationCOMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012
Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about
More informationQuestions 1 through 25 are worth 2 points each. Choose one best answer for each.
Questions 1 through 25 are worth 2 points each. Choose one best answer for each. 1. For the singly linked list implementation of the queue, where are the enqueues and dequeues performed? c a. Enqueue in
More information3. Convert a number from one number system to another
3. Convert a number from one number system to another Conversion between number bases: Hexa (16) Decimal (10) Binary (2) Octal (8) More Interest Way we need conversion? We need decimal system for real
More informationData Structures. Jaehyun Park. CS 97SI Stanford University. June 29, 2015
Data Structures Jaehyun Park CS 97SI Stanford University June 29, 2015 Typical Quarter at Stanford void quarter() { while(true) { // no break :( task x = GetNextTask(tasks); process(x); // new tasks may
More informationSymbol Tables. Introduction
Symbol Tables Introduction A compiler needs to collect and use information about the names appearing in the source program. This information is entered into a data structure called a symbol table. The
More informationCS711008Z Algorithm Design and Analysis
CS711008Z Algorithm Design and Analysis Lecture 7 Binary heap, binomial heap, and Fibonacci heap 1 Dongbo Bu Institute of Computing Technology Chinese Academy of Sciences, Beijing, China 1 The slides were
More informationPrevious Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles
B-Trees Algorithms and data structures for external memory as opposed to the main memory B-Trees Previous Lectures Height balanced binary search trees: AVL trees, red-black trees. Multiway search trees:
More information1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:
Exercises 1 - number representations Questions 1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: (a) 3012 (b) - 435 2. For each of
More informationFull and Complete Binary Trees
Full and Complete Binary Trees Binary Tree Theorems 1 Here are two important types of binary trees. Note that the definitions, while similar, are logically independent. Definition: a binary tree T is full
More informationfor ECM Titanium) This guide contains a complete explanation of the Driver Maker plug-in, an add-on developed for
Driver Maker User Guide (Plug-in for ECM Titanium) Introduction This guide contains a complete explanation of the Driver Maker plug-in, an add-on developed for ECM Titanium, the chip-tuning software produced
More informationA binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:
Binary Search Trees 1 The general binary tree shown in the previous chapter is not terribly useful in practice. The chief use of binary trees is for providing rapid access to data (indexing, if you will)
More informationOriginal-page small file oriented EXT3 file storage system
Original-page small file oriented EXT3 file storage system Zhang Weizhe, Hui He, Zhang Qizhen School of Computer Science and Technology, Harbin Institute of Technology, Harbin E-mail: wzzhang@hit.edu.cn
More informationNumeration systems. Resources and methods for learning about these subjects (list a few here, in preparation for your research):
Numeration systems This worksheet and all related files are licensed under the Creative Commons Attribution License, version 1.0. To view a copy of this license, visit http://creativecommons.org/licenses/by/1.0/,
More informationData Storage 3.1. Foundations of Computer Science Cengage Learning
3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how
More informationNumber Systems. Introduction / Number Systems
Number Systems Introduction / Number Systems Data Representation Data representation can be Digital or Analog In Analog representation values are represented over a continuous range In Digital representation
More informationCDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012
CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 Outline Data Representation Binary Codes Why 6-3-1-1 and Excess-3? Data Representation (1/2) Each numbering
More informationCount the Dots Binary Numbers
Activity 1 Count the Dots Binary Numbers Summary Data in computers is stored and transmitted as a series of zeros and ones. How can we represent words and numbers using just these two symbols? Curriculum
More informationBachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)
Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating
More information