Mway Huffman tree - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Mway Huffman tree

Description:

M-way Huffman tree. Why do we need to add zeroes to our list? ... Before adding zeroes, tree cost = 32. After adding zeroes, tree cost = 26 ... – PowerPoint PPT presentation

Number of Views:90
Avg rating:3.0/5.0
Slides: 12
Provided by: jfsh
Category:
Tags: huffman | mway | tree

less

Transcript and Presenter's Notes

Title: Mway Huffman tree


1
M-way Huffman tree
  • Why do we need to add zeroes to our list?
  • Given a list of numbers 4, 2, 6, 8, construct a
    3-way huffman tree

2
M-way Huffman tree
  • Why do we need to add zeroes to our list?
  • 4 2 6 8
  • Step 1 find the 3 min members of the list

2
4
6
3
M-way Huffman tree
  • Why do we need to add zeroes to our list?
  • 8
  • Step 2 construct tree and return to list

12
2
4
6
4
M-way Huffman tree
  • Why do we need to add zeroes to our list?
  • 8
  • Step 3 construct next tree with the next 3 min
    members

12
20
12
8
2
4
6
5
M-way Huffman tree
  • Why do we need to add zeroes to our list?
  • Final tree cost 32

20
12
8
2
4
6
6
M-way Huffman tree
  • Now, construct a new 3-way huffman tree, but
    first add (1-n)mod(m-1) zeroes to the list
  • List 4 2 6 8, so n 4, m 3
  • zeroes to add (1-4)mod(3-1) -3mod2 1

7
M-way Huffman tree
  • Why do we need to add zeroes to our list?
  • New list 4 2 6 8 0
  • Step 1 find the 3 min members of the list

0
2
4
8
M-way Huffman tree
  • Why do we need to add zeroes to our list?
  • 6 8
  • Step 2 construct tree and return tree to list

6
0
2
4
9
M-way Huffman tree
  • Why do we need to add zeroes to our list?
  • 6 8
  • Step 3 construct next tree with the next 3 min
    members

6
20
6
8
6
0
2
4
10
M-way Huffman tree
  • Why do we need to add zeroes to our list?
  • Final tree cost 26

20
6
8
6
0
2
4
11
M-way Huffman tree
  • Why do we need to add zeroes to our list?
  • Before adding zeroes, tree cost 32
  • After adding zeroes, tree cost 26
  • By adding zeroes prior to constructing the m-way
    huffman tree we can reduce the overall cost of
    the tree
Write a Comment
User Comments (0)
About PowerShow.com