自顺应霍夫曼编码的C++版本简单实现classAdaptiveTree{public: AdaptiveTree(introotNum); AdaptiveTree(introotNum,stringstr); voidswap(intfirst,intsecond); //swaptwonodesofthetree voidinitalCode(); //initializingthedata stringchar2code(unsignedcharletter); //locatethecharacterinthetreewithitscorrespondingbinarystringandreturnthestring stringchar2binary(unsignedcharletter); //translatingthecharactertothe8-bitbinarystring unsignedcharbinary2char(stringbin); //translatingthebinarystring:bintothecorrespondingcharacter intspawn(unsignedcharletter); //addanewcharactertotheoriginaltree voidupdateTree(unsignedcharnewchar); //updatethetree inthighestInBlock(intcount); //returnthehighestnodetobeexchanged voidsetString(stringstr); // stringdecodingStr()const; voidencoding(); stringdecoding(); unsignedcharcode2char(stringbincode); staticintsize(); stringbinStr()const;//returnthebinarystringofstring:tempStringprivate: voidrun(); intfindchar(unsignedcharletter); //locatetheletterinthetree stringtempString; //tempstringtobeencodedneededtobestoredhere stringdeStr;//usedforstoringthedecodingstring stringbin;//usedforstoringtheresultofencodingprocess /*AdaptiveTreedatamembers*/ HuffmanTree*tree;introot; /*AdaptiveTreeconstants*/ staticintALPH_SIZE;//sizeofthealphabetstaticunsignedcharnone;//notaunsignedcharacterstaticunsignedcharNYT;//NotYettransmittedcode};
2017/6/9 18:05:54 3KB adaptive Huffman Coding 自适应
1
在日常工作中,钉钉打卡成了我生活中不可或缺的一部分。然而,有时候这个看似简单的任务却给我带来了不少烦恼。 每天早晚,我总是得牢记打开钉钉应用,点击"工作台",再找到"考勤打卡"进行签到。有时候因为工作忙碌,会忘记打卡,导致考勤异常,影响当月的工作评价。而且,由于我使用的是苹果手机,有时候系统更新后,钉钉的某些功能会出现异常,使得打卡变得更加麻烦。 另外,我的家人使用的是安卓手机,他们也经常抱怨钉钉打卡的繁琐。尤其是对于那些不太熟悉手机操作的长辈来说,每次打卡都是一次挑战。他们总是担心自己会操作失误,导致打卡失败。 为了解决这些烦恼,我开始思考是否可以通过编写一个全自动化脚本来实现钉钉打卡。经过一段时间的摸索和学习,我终于成功编写出了一个适用于苹果和安卓系统的钉钉打卡脚本。
2024-04-09 15:03 15KB 钉钉 钉钉打卡