Update compress.cpp, complete implementation. may have bugs( testing required )