A text is made up of the characters A, B, C, D, E each occurring with the probability 0.08, 0.40, 0.25, 0.15 and 0.12 respectively. The optimal coding technique will have the average length of:

This question was previously asked in
UGC NET Computer Science (Paper 2) July 2018 Paper
View all UGC NET Papers >
  1. 2.4
  2. 1.87
  3. 3.0
  4. 2.15

Answer (Detailed Solution Below)

Option 4 : 2.15
Free
UGC NET Paper 1: Held on 21st August 2024 Shift 1
50 Qs. 100 Marks 60 Mins

Detailed Solution

Download Solution PDF

Concept:

Optimal coding technique merge the probabilities one by one starting from the lower one.

Explanation:

Characters are: A, B, C, D and E with probabilities 0.08, 0.40, 0.25, 0.15, 0.12 respectively.

Step 1: Merge 0.08 (A) and 0.12, (E)

Step 2: Merge 0.20 with 0.15(D)

Step 3: Merge 0.35 and 0.25 (C)

Step 4: Merge 0.60 with 0.40 (B), then assign 0 to all left edges and 1 to all right edges.

Code for A (0.08) = 1110 (length 4)

Code for B (0.40) = 0 (length 1)

Code for C (0.25) = 10(length 2)

Code for D (0.15) = 110 (length 3)

Code for E (0.12) = 1111 (length 4)

Average code length = [(0.08 × 4) + (0.40 × 1) + (0.25 × 2) + (0.15 × 3) + (0.12 × 4)] / 1 = 0.32 + 0.40 + 0.50 + 0.45 + 0. 48 = 2.15

Latest UGC NET Updates

Last updated on Jun 19, 2025

-> The UGC NET City Slip 2025 has been released on its official website today.

-> The UGC NET June 2025 exam will be conducted from 25th to 29th June 2025.

-> The UGC-NET exam takes place for 85 subjects, to determine the eligibility for 'Junior Research Fellowship’ and ‘Assistant Professor’ posts, as well as for PhD. admissions.

-> The exam is conducted bi-annually - in June and December cycles.

-> The exam comprises two papers - Paper I and Paper II. Paper I consists of 50 questions and Paper II consists of 100 questions. 

-> The candidates who are preparing for the exam can check the UGC NET Previous Year Papers and UGC NET Test Series to boost their preparations.

More Greedy Algorithms Questions

More Algorithm Design Techniques Questions

Hot Links: teen patti diya teen patti master update teen patti master 2025