Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Question
Chapter 16.3, Problem 6E
Program Plan Intro
To represent optimal prefix code on C using
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Recall, by 15-bit strings, we mean strings of binary digits, of length 15.
a. How many 15-bit strings are there total?
b. How many 15-bit strings have weight 6?
c. How many subsets of the set {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15} contain exactly 6 elements?
A
▶
FI
I ANALYSIS. Read the following situations and analyze the fundamentals of multimedia
elements.
1. A multimedia company uses a compression technique to encode the message
before transmitting over the network. Suppose the message contains the
following characters with their frequency:
Character A
Frequency 5
b
9
C
d
e
f
12
13 16
a. Build the Huffman code tree for given message as given.
b. Use Huffman tree to find code for each character.
45
c. If the data consists of only these characters, what is the total number of bits
to be transmitted?
d. Find the number of bits is sent with 8-bit ASCII values without compression?
def mystery (1st);
for idx in range(1, len(1st));
tmp = 1st[idx)
idx2 = idx
while 1dx2 > 9 and 1st[idx2-11 tmp:
1st[idx2] 1st[10/2 - 11
1dx2 = 1dx2 - 1
1st[idx2] = tmp
print(1st)
a. If we call this function as follows: mystery(lt) where ist 15, 2, 8, 11, what is printed out t
clear about what is printed out, don't make me try to figure it out).
b. What does this function do?
c. What is the complexity of this function? Oni Ora, On³ Ologinil, Onioginil? Explain your
reasoning
Chapter 16 Solutions
Introduction to Algorithms
Ch. 16.1 - Prob. 1ECh. 16.1 - Prob. 2ECh. 16.1 - Prob. 3ECh. 16.1 - Prob. 4ECh. 16.1 - Prob. 5ECh. 16.2 - Prob. 1ECh. 16.2 - Prob. 2ECh. 16.2 - Prob. 3ECh. 16.2 - Prob. 4ECh. 16.2 - Prob. 5E
Ch. 16.2 - Prob. 6ECh. 16.2 - Prob. 7ECh. 16.3 - Prob. 1ECh. 16.3 - Prob. 2ECh. 16.3 - Prob. 3ECh. 16.3 - Prob. 4ECh. 16.3 - Prob. 5ECh. 16.3 - Prob. 6ECh. 16.3 - Prob. 7ECh. 16.3 - Prob. 8ECh. 16.3 - Prob. 9ECh. 16.4 - Prob. 1ECh. 16.4 - Prob. 2ECh. 16.4 - Prob. 3ECh. 16.4 - Prob. 4ECh. 16.4 - Prob. 5ECh. 16.5 - Prob. 1ECh. 16.5 - Prob. 2ECh. 16 - Prob. 1PCh. 16 - Prob. 2PCh. 16 - Prob. 3PCh. 16 - Prob. 4PCh. 16 - Prob. 5P
Knowledge Booster
Similar questions
- My question is : 1 Decode the following 21 bit string and draw the resulting labeled 0-rooted tree. (no justification necessary.) 000 101 110 101 001 000 000 2 This is not an onto encoding. Construct a 21-bit string that is not decodable and explain why it is not decodable.arrow_forwardLet's say that the components of U are arranged in ascending order, with U = l, 2, 3, 4, 5, 6, 7, 8, 9, and 1 O, which means that aj = i. What bit strings encompass the subsets of all odd numbers in U, all even integers in U, and all integers in U that do not exceed 5?arrow_forwardImagine that Huffman Encoding is to be used in the previous example with the same letters, A. E, K and L and the Encoding is represented using a Binary Tree. The following frequencies are given for these respective letters as typically occurring in English text. Frequency(A)-0.35 Frequency(E)-0.24 Frequency(K)-0.21 FrequelicytL)-0.17 Using the Greedy Template in Huffman Encoding, which letters will most appropriately be the leaves of the Binary Tree? (Note: Consider only these letters for now] O Eand K OAand E O Land A O Kand L No new itata to sve. Last checked at 620om Submit Quarrow_forward
- Let be ⊕ a binary operation on N. This is true about ⊕. 1. ∀a ∈ N, a ⊕ 0 = 0 2. ∀a, b ∈ N, a ⊕ b = b ⊕ a 3. ∀a, b ∈ N, a ⊕ b ∈ N 4. ∀a, b ∈ N, a ⊕ (a ⊕ b) = a ⊕ a ⊕ a ⊕ barrow_forwardProblem 2: Let Un, for n ≥ 0, be the number of binary strings of length n in which no two 0's are at distance two apart. (More precisely, the difference of their positions in the string cannot be equal 2.) For example, U4 = 9, because there are 9 binary strings of length 4 that satisfy this condition: 0011, 0110, 0111, 1001, 1011, 1100, 1101, 1110, 1111. Derive the recurrence equation for Un. You need to give a clear and complete justification for your equation. (You do not need to solve the recurrence.)arrow_forwardLet s = σ1. . . σk be a binary string of length k > 0. We say that a binary string w = w1 . . . wn contains s as a subsequence if there are k indices 1 ≤ i1 < i2, . . . < ik ≤ n such that wik = sr for every 1 ≤ r ≤ k. For example, if s = 11 then 10001, 1010 and 110 contain s as a subsequence whereas 000 and 1000 do not. Prove that the language of all binary strings containing a fixed binary string s of length k as a subsequence is a regular language.arrow_forward
- How many length-5 binary strings contain exactly two 1s? How many length-5 ternary strings over E = {0, 1, 2} contain exactly two 2s? Let S CZ with |S| = n. What is the maximum value of |{a + b : a, b ES A a # b}|?arrow_forwardProblem 1 . Consider the following binary search tree: 26 10 43 38 47 15 12 25 31 40 Show the resulting tree if you add the entry with key = 13 to the above tree. You need to describe, step by step, how the resulting tree is generated.arrow_forwardPlease Help ASAP!!!arrow_forward
- give a detailed explanation of how to create a minimum spanning tree using Prim's technique (MST) dont copyarrow_forward9....arrow_forwardThe table shows the distances, in units of 100 m, between seven houses, A to G. A В D E F G A 4 3 B 4 1 2 4 7 5 1 3 7 D 3 2 6 4 E 2 4 4 2 6 F 7 6 10 G 6 6 7 4 10 Use Prim's algorithm on the table in the insert to find a minimum spanning tree. Start by crossing out row A. Show which entries in the table are chosen and indicate the order in which the rows are deleted. Draw your minimum spanning tree and state its total weight. 4) LOarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education