Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Which of these codes are prefix codes?

a) a: 11, e: 00, t: 10, s: 01

b) a: 0, e: 1, t: 01, s: 001

c) a: 101, e: 11, t: 001, s: 011, n: 010

d) a: 010, e: 11, t: 011, s: 1011, n: 1001, i: 10101

Short Answer

Expert verified
  1. Yes
  2. No
  3. Yes
  4. Yes

Step by step solution

Achieve better grades quicker with Premium

  • Unlimited AI interaction
  • Study offline
  • Say goodbye to ads
  • Export flashcards

Over 22 million students worldwide already upgrade their learning with Vaia!

01

(a) Consider the code a:11, e:00, t:10, s:01.

The bit string 11 represents the letter ‘a’ and the letter ‘a’ not contains other letters e, t,s in the sequence of bits in it.

The bit string 00 represents the letter ‘e’ and the letter ‘e’ not contains other letters a, t,s in the sequence of bits in it.

The bit string 10 represents the letter ‘t’ and the letter ‘t’ not contains other letters a,e,s in the sequence of bits in it.

The bit string 01 represents the letter ‘s’ and the letter ‘s’ not contains other letters a,e,t in thesequence of bits in it.

Therefore, by the definition of prefix codes, the given code is a prefix code.

02

(b) Consider the code a:0,e:1,t:01,s:001.

The bit string 0 represents the letter ‘a’ and the letter ‘a’ not contains other letters e, t,s in the sequence of bits in it.

The bit string 1 represents the letter ‘e’ and the letter ‘e’ not contains other letters a, t,s in the sequence of bits in it.

The bit string 01 represents the letter ‘t’ and the letter ‘t’ is the sequence of other letters a and e.

The bit string 001 represents the letter ‘s’ and the letter ‘s’ is the sequence of other letters a and t.

Hence, by the definition of prefix codes, the given code is not a prefix code.

03

(c) Consider the code a: 101, e: 11, t: 001, s: 011, n: 010.

The bit string 101 represents the letter ‘a’ and the letter ‘a’ not a sequence of other letters e,t,s,n.

The bit string 11 represents the letter ‘e’ and the letter ‘e’ not a sequence of other letters a, t,s,n.

The bit string 001 represents the letter ‘t’ and the letter ‘t’ not a sequence of other letters a,e,s,n.

The bit string 011 represents the letter ‘s’ and the letter ‘s’ not contains other letters a,e, t,n in the sequence of bits in it.

The bit string 010 represents the letter ‘n’ and the letter ‘n’ not contains other letters a,e, t,s in the sequence of bits in it.

So, by the definition of prefix codes, the given code is a prefix code.

04

(d) Consider the code a: 010, e: 11, t: 011, s: 1011, n: 1001, i: 10101.

The bit string 010 represents the letter ‘a’ and the letter ‘a’ not a sequence of other letters e, t,s,n, i.

The bit string 11 represents the letter ‘e’ and the letter ‘e’ not a sequence of other letters a, t,s,n, i.

The bit string 011 represents the letter ‘t’ and the letter ‘t’ not a sequence of other letters a,e,s,n, i.

The bit string 1011 represents the letter ‘s’ and the letter ‘s’ not a sequence of other letters a,e, t,n, i.

The bit string 1001 represents the letter ‘n’ and the letter ‘n’ not contains other letters a,e, t,s,i in the sequence of bits in it.

The bit string 10101 represents the letter ‘i’ and the letter ‘i’ not contains other letters a,e,t,s,n in the sequence of bits in it.

Consequently, by the definition of prefix codes, the given code is a prefix code.

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

When Kruskal invented the algorithm that finds minimumspanning trees by adding edges in order of increasing weightas long as they do not form a simple circuit, he also inventedanother algorithm sometimes called the reverse-delete algorithm. This algorithm proceeds by successively deletingedges of maximum weight from a connected graph as long asdoing so does not disconnect the graph.

Express the reverse-delete algorithm in pseudocode.

Devise an algorithm based on breadth-first search for finding the connected components of a graph.

Which of these are well-formed formulae over the symbols \(\left\{ {{\bf{x,y,z}}} \right\}\) and the set of binary operators \(\left\{ {{\bf{ \ast , + ,}} \circ } \right\}\)?

  1. \({\bf{ \ast + + xyx}}\)
  2. \( \circ {\bf{xy \ast xz}}\)
  3. \({\bf{ \ast }} \circ {\bf{xz \ast \ast xy}}\)
  4. \({\bf{ \ast + }} \circ {\bf{xx}} \circ {\bf{xxx}}\)

Show that postorder traversals of these two ordered rooted trees produce the same list of vertices. Note that this does not contradict the statement in Exercise 27, because the numbers of children of internal vertices in the two ordered rooted trees differ.

Well-formed formulae in prefix notation over a set of symbols and a set of binary operators are defined recursively by these rules:

  1. If x is a symbol, then x is a well-formed formula in prefix notation;
  2. If X and Y are well-formed formulae and * is an operator, then * XY is a well-formed formula.

Is the rooted tree in Exercise \(3\) a full \({\bf{m}}\)-ary tree for some positive integer \({\bf{m}}\)?

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free