Algorithms For Dummies



Download 7,18 Mb.
Pdf ko'rish
bet468/651
Sana15.07.2021
Hajmi7,18 Mb.
#120357
1   ...   464   465   466   467   468   469   470   471   ...   651
Bog'liq
Algorithms

  Compressing Data 

     279


        else:

            print ('Not found:',current,'Output:',

                   reverse_dictionary[previous

                    ] 

+ reverse_dictionary[previous][0])

            s = reverse_dictionary[previous

                    ] 

+ reverse_dictionary[previous][0]

            print ('New dictionary entry %s at index %s' %

                   (s, max(reverse_dictionary.keys())

+1))

            reverse_dictionary[



                max(reverse_dictionary.keys())

+1] = s


            print ('Decompressed %s' % s)

            output 

+= s

            print ('>%s' % output)



    return output

Running the function on the previously compressed sequence recovers the origi-

nal information by scanning through the symbolic table, as shown here:

print ('\ndecompressed string : %s' %

       lzw_decompress(compressed))

print ('original string was : %s' % text)

Decompressed A

> A


Decompressed B

> AB


New dictionary entry AB at index 256

Decompressed AB

> ABAB

New dictionary entry BA at index 257



Decompressed C

> ABABC


New dictionary entry ABC at index 258

Decompressed ABC

> ABABCABC

New dictionary entry CA at index 259

Decompressed ABC

> ABABCABCABC

New dictionary entry ABCA at index 260

decompressed string : ABABCABCABC

original string was : ABABCABCABC





Download 7,18 Mb.

Do'stlaringiz bilan baham:
1   ...   464   465   466   467   468   469   470   471   ...   651




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2025
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish