• Pseudo va phyton bo‘yicha ko’ribchiqish
  • 10: begin 11: if (|S|>1) then
  • // C++ program for Shannon Fano Algorithm
  • Shennon fano algoritmning ishlashi




    Download 0,92 Mb.
    bet4/5
    Sana20.02.2024
    Hajmi0,92 Mb.
    #159700
    1   2   3   4   5
    Bog'liq
    Parametrik tenglama bilan berilgan chiziq urinmasi va normali tenglamalari, Non pishirishda kechadigan jarayonlar mohiyati, Fuqaro muhofazasining kuch va vositalari. Reja Fuqaro muhofazas, MUSTAQIL ISH, jhg,jhg,, 1 qadam, 9-ma’ruza, 10-ma’ruza, XMGlobal-Risk-Disclosures-for-Financial-Instruments-1, Jahon tarixi 10 uzb 2022, Anvarov B, pdf, dilshodbek.org, Jahon banki, document

    Shennon fano algoritmning ishlashi

    • Ikkala yarmining har biriga 3 va 4-bosqichlarni dumaloq tarzda qo'llang, guruhlarni kichikroq kichik guruhlarga bo'ling va har bir belgi daraxtda mos keladigan kod bargiga aylanmaguncha kodlarga bitlarni kiriting.
    • Misol: • ABCDE belgisi sifatida • Hisoblash A 15 B 7 C 6 D 6 E 5
    • Belgisi: ABCDE • Kod A 00 B 01 C 10 D 110 E 111
    • Amalga oshirish
    • Yuqoridagi yondashuvni amalga oshirish:
    • Pseudo-kod

    Pseudo va phyton bo‘yicha ko’ribchiqish

    1: begin

    2: count source units

    3: sort source units to non-decreasing order

    4: SF-SplitS

    5: output(count of symbols, encoded tree, symbols)

    6: write the output

    7: end

    8:

    9: procedure SF-Split(S)

    10: begin

    11: if (|S|>1) then

    12: begin

    13: divide S by S1 and S2 with about the same count of units

    14: add 1 to codes in S1

    15: add 0 to codes in S2

    16: SF-Split(S1)

    17: SF-Split(S2)

    18: end

    19: end

    // C++ program for Shannon Fano Algorithm

    // C++ program for Shannon Fano Algorithm

    #include

    using namespace std;

    // declare structure node

    struct node {

    // for storing symbol

    string sym;

    // for storing probability or frequency

    float pro;

    int arr[20];

    int top;

    } p[20];

    typedef struct node;

    // function to find shannon code

    void shannon(int l, int h, node p[])

    {


    Float pack1 = 0, pack2 = 0, diff1 = 0, diff2 = 0;
    int i, d, k, j;
    if ((l + 1) == h || l == h || l > h) {
    if (l == h || l > h)
    return;
    p[h].arr[++(p[h].top)] = 0;
    p[l].arr[++(p[l].top)] = 1;
    return;
    {
    for (i = l; i <= h – 1; i++)
    pack1 = pack1 + p[i].pro;
    pack2 = pack2 + p[h].pro;
    diff1 = pack1 – pack2;
    if (diff1 < 0)
    diff1 = diff1 * -1;
    j = 2;
    while (j != h – l +

    Download 0,92 Mb.
    1   2   3   4   5




    Download 0,92 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Shennon fano algoritmning ishlashi

    Download 0,92 Mb.