Kompresi Huffman

Post on 03-Apr-2015

143 views 2 download

description

Huffman Text Compression, Created By: Andysah Putra Utama Siahaan, S.Kom

transcript

Huffman Algorithmfor Text CompressionCreated By: Andysah Putra U. Siahaan, S.Kom

107038005

Introduction

•What is data compression?•What is binary encoding?•What is FLBE?

Huffman Theory

String : “LIKA LIKU LAKI-LAKI TAK LAKU-LAKU”

Character Set : “LIKA-U T”

CHAR L I K A - U T

FREQ 6 4 7 6 3 3 3 1

Huffman Theory

The Table must be sorted with ascending order.

CHAR T - U I L A K

FREQ 1 3 3 3 4 6 6 7

Phase One

T

1

-

3

*

4

U * I L A K

3 3 4 4 6 6 7

Phase Two

U

3

-

3

*

6

* I * L A K

4 4 6 6 6 7

Phase Three

*

4

I

4

*

8

* L A K *

6 6 6 7 8

Phase Four

*

6

L

6

*

12

A K * *

6 7 8 12

Phase Five

A

6

K

7

*

13

* * *

8 12 13

Phase Six

*

8

*

12

*

20

* *

13 20

Phase Seven

*

13

*

20

*

33

*

33

Huffman Tree

*

13

*

20

*

33

*

8

*

12

A

6

K

7

*

6

L

6

*

4

I

4

U

3

-

3

T

1

-

3

Huffman Table

CHAR CODE LENGTH FREQ CL * F

L 111 3 6 18

I 101 3 4 12

K 01 2 7 14

A 00 2 6 12

- 1001 4 3 12

U 1100 4 3 12

SPACE 1101 4 3 12

T 1000 4 1 4

Compression Method

Binary Code :

111 101 01 00 1001 111 101 01 1100 1101 111 00 01 101 1001 111 00 01 101 1101 1000 00 01 1101 111 00 01 1100 1001 111 00 01 1100

ASCII Convertered Bit

Binary Code : 11110101 00100111 11010111 00110111 10001101 10011110 00110111 0110000001110111 10001110 01001111 00011100

Decimal Code:245, 39, 215, 55, 141, 158, 55, 96119, 142, 79, 28

ASCII Table

ASCII Table (Extended)

Result

Decimal Code:245, 39, 215, 55, 141, 158, 55, 96119, 142, 79, 28

Conclusion

Huffman is one of the compression algorithm. Huffman algorithm is the most famous algorithm to compress text. There are three phases in the Huffman algorithm to compress a text, the first is the phase formation of the Huffman tree, the second phase of the three phases of encoding and decoding. The last phase is converting into text.

Thanks For Watching