Coder Social home page Coder Social logo

huffmanzip-unzip's Introduction

-利用哈夫曼编码算法实现压缩与解压(练习版)

利用赫夫曼压缩文件的核心**是“压缩”压缩体现在将八个二进制位变成一个字节存储如11101001转换成字节后是按照补码存储则变成10010111第一位为符号位,此时实际存储在 字节数组中的是00000011对应的3。解压缩的时候将3取出转为int类型也是3但是二进制位只有11前面不会用0补齐负数的时候前面都是用1补齐,所以要按位或256,256实际是100000000 所以按位或完之后11就变成100000011我们只需要取后八位就变成00000011了,与存入的二进制位相匹配,最后将字节数组再通过流输出就完成解压了。

huffmanzip-unzip's People

Contributors

dealw avatar

Watchers

James Cloos avatar  avatar

Forkers

unizy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.