Algorithms For Dummies



Download 7,18 Mb.
Pdf ko'rish
bet183/651
Sana15.07.2021
Hajmi7,18 Mb.
#120357
1   ...   179   180   181   182   183   184   185   186   ...   651
Bog'liq
Algorithms

 

»

Queues: A queue is a first in/first out (FIFO) collection. You use it to track 

items that need to be processed in some way. Think of a queue as a line at the 

bank. You go into the line, wait your turn, and are eventually called to talk with 

a teller.



 

»

Deques: A double-ended queue (deque) is a queue-like structure that lets you 

add or remove items from either end, but not from the middle. You can use a 

deque as a queue or a stack or any other kind of collection to which you’re 

adding and from which you’re removing items in an orderly manner (in 

contrast to lists, tuples, and dictionaries, which allow randomized access and 

management).

Of all the sequences, lists are the easiest to understand and are the most directly 

related to a real-world object. Working with lists helps you become better able to 

work with other kinds of sequences that provide greater functionality and 

improved  flexibility.  The  point  is  that  the  data  is  stored  in  a  list  much  as  you 

would write it on a piece of paper: One item comes after another. The list has a 

beginning, a middle, and an end. Python numbers the items in the list. (Even if 

you might not normally number the list items in real life, using a numbered list 

makes the items easy to access.) To see how you can work with lists, start a copy 

of IPython and type the following code:

ListA = [0, 1, 2, 3]

ListB = [4, 5, 6, 7]

ListA.extend(ListB)

ListA

When you type the last line of code, you see the output of 



[0, 1, 2, 3, 4, 5, 

6, 7]


. The 

extend()


 function adds the members of 

ListB


 to 

ListA


. Besides extend-

ing lists, you can also add to them by using the 

append()

 function. Type ListA.




Download 7,18 Mb.

Do'stlaringiz bilan baham:
1   ...   179   180   181   182   183   184   185   186   ...   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