FANO-Algorithmus für vc++
-
Hi,
folgendes Problem, soll ein Programm schreiben, welches den Shannon-Fano Algorithmus dem Hufman-Algorithmus gegenüber stellt.
An Literatur habe ich genug gefunden, habe es auch einiger maßen geschnallt. Aber ich habe im ganzen Netz keinen einzigen Quellcode gefunden.
Gibts sowas! Wer kann mir helfen.
CU
-
-
Hi,
sie sind mein Held.
CU
P.S: klasse Tutorials auf der Page. Wer weis, wo ich heute ohne diese wäre!!
-
Gern geschehen.
-
Hi,
ich versuche jetzt schon seit Tagen mit dem Algorithmus des Programms turbocpp klarzukommen nur ich bin der Meinung daß es fehlerhaft ist und nicht das zurückliefert was es sollte. Ich habe es so umgeschrieben, daß es mir die Bitfolgen für jeden Buchstaben ausgibt.
Nur bei der Eingabe von ABRAKADABRA erscheint folgendes:
A 5 = 00
B 2 = 11
R 2 = 11
D 1 = 010
K 1 = 010Nur da stimmt doch was nicht. Es können doch nicht mehrere Buchstaben die gleiche Bitfolge haben? Kennt nicht jemand irgendeine Referenzseite wo es noch einen Code gibt zum Durchstöbern. Es kann doch nicht sein, daß der Code hier der einzige im ganzen Web ist.
Also ich bin vollkommen fertig.
CU
-
The Algorithm
For a given list of symbols, develop a corresponding list of probabilities or frequency counts so that each symbol’s relative frequency of occurrence is known. Sort the lists of symbols according to frequency, with the most frequently occurring symbols at the top and the least common at the bottom. Then:Divide the list into two parts, with the total frequency counts of the upper half being as close to the total of the bottom half as possible.
The upper half of the list is assigned the binary digit 0, and the lower half is assigned the digit 1. This means that the codes for the symbols in the first half will all start with 0, and the codes in the second half will all start with 1.
Recursively apply the same procedure to each of the two halves, subdividing groups and adding bits to the codes until each symbol has become a corresponding code leaf on the tree.
-
-
-
http://alfin.mine.utsunomiya-u.ac.jp/~niy/algo/s/shannon.html
siehe dort:
http://alfin.mine.utsunomiya-u.ac.jp/~niy/algo/s/shannon-test.c
http://alfin.mine.utsunomiya-u.ac.jp/~niy/algo/s/shannon.c
-
Marco230482 schrieb:
Hi,
Aber ich habe im ganzen Netz keinen einzigen Quellcode gefunden.
Gibts sowas! Wer kann mir helfen.
Ich dachte, DU solltest das programmieren.
Marco230482 schrieb:
Hi,
P.S: klasse Tutorials auf der Page. Wer weis, wo ich heute ohne diese wäre!!
Dann hättest du selber was gelernt und geschafft ?