2016年8月7日 星期日

An array in PHP is actually an ordered map.

An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other arrays, trees and multidimensional arrays are also possible.
Explanation of those data structures is beyond the scope of this manual, but at least one example is provided for each of them. For more information, look towards the considerable literature that exists about this broad topic.

2016年7月24日 星期日

算數碼法

資料壓縮一直是一個很重要的研究,特別在這一個網路的時代,要讓更多的資料利用有限的頻寬來傳輸,他的價值更能顯現出來。

  算數碼法(Arithmetic Coding)是Rissanen 於1979年所提出的一種壓縮方法,這方法最大的特點在於以一實數來表示壓縮字串。將一段message利用一個0到1間的區間來表示,當這個message越長,用來表示這個message的區間就越小,那要表示這個message的bit數就變多。相同的文字在message出現越多,區間變小的速度比較慢所以可以達到資料壓縮的效果。隨著符號序列長度之增加,其算數編碼長度之entropy趨近於無雜訊編碼理論之極限(效率愈高)。

  除了算術編碼外,常見的演算法還有霍夫曼法(Huffman),原理是將欲壓縮之字串,先讀一遍,將字串中的每一相異單字元(Single Character)的出現頻率,做成統計,依此建構霍夫曼樹(Huffman’s Tree)。每一相異單字元,用0與1予以編碼,出現次數逾多者,給予較少的位元編碼。霍夫曼編碼法的特點在於所編碼出來的檔案具有唯一碼性質的即時碼。也就是各個相異字元所編碼出所位元串並不相同,解碼時能立即解出。


http://webcache.googleusercontent.com/search?q=cache:8QH1ejpx9lcJ:par.cse.nsysu.edu.tw/~homework/algo01/8934609/index.html+&cd=2&hl=zh-TW&ct=clnk&gl=tw

http://par.cse.nsysu.edu.tw/~homework/algo01/8934609/index.html

ARITH.exe --> A.e --> a.D == A.dd