Seminar
Seminar
Note :
Si Start Time
Fi Finishing Time
Steps
Sort the activity by arranging the finishing time (Fi) in ascending order
Arrange the sorted list in a way that it does not overlap with the previous activity
Algorithm
Example
Consider the following set of activities with their start and finish times:
Activity 1: (1, 4)
Activity 2: (3, 5)
Activity 3: (0, 6)
Activity 4: (5, 7)
Activity 5: (8, 9)
Activity 6: (5, 9)
Step 1: Sort Activities by Finish Time
Sorted Activities: (1, 4), (3, 5), (0, 6), (5, 7), (8, 9), (5, 9)
HUFFMAN CODE
1. Frequency Table
2. Priority Queue
3. Tree Construction
4. Code Assignment
Example
Character Frequency
A 5
B 9
C 12
D 13
E 16
F 45
Character Frequency
Step-by-Step Construction:
o (A, 5), (B, 9), (C, 12), (D, 13), (E, 16), (F, 45)
2. First Iteration:
o Queue: (C, 12), (D, 13), (E, 16), (F, 45), (AB, 14)
3. Second Iteration:
4. Third Iteration:
5. Fourth Iteration:
6. Final Iteration:
Huffman Tree:
Code Assignment:
A: 1100
B: 1101
C: 100
D: 101
E: 111
F: 0
Optimality: Produces the most efficient prefix code for a given set of character frequencies.
Compression: Significantly reduces the amount of data needed to represent the original
information.
Applications
Huffman coding is a fundamental algorithm in data compression, providing a simple yet powerful
method to reduce the size of data without losing information.