Reja: Iteratorlar. Iteratorlarning toifalari; Iteratotlar-adapterlar



Download 1,97 Mb.
bet11/11
Sana12.04.2022
Hajmi1,97 Mb.
#547204
1   2   3   4   5   6   7   8   9   10   11
Bog'liq
4- taqdimot

Standart algoritmlar

  • Nomi
  • Nomi
  • 1
  • copy(from, from_end, to)
  • 12
  • reverse(begin, end)
  • 2
  • copy_if(from, from_end, to, pred)
  • 13
  • reverse_copy(from, from_end, to)
  • 3
  • copy_n(from, count, to)
  • 14
  • rotate(begin, new_begin, end)
  • 4
  • copy_backward(from, from_end, to_end) 
  • 15
  • rotate_copy(from, new_begin, from_end, to)
  • 5
  • move(from, from_end, to)
  • 16
  • find(begin, end, value)
  • 6
  • move_backward(from, from_end, to_end) 
  • 17
  • find_if(begin, end, pred) 
  • 7
  • swap_ranges(a, a_end, b)
  • 18
  • find_if_not(begin, end, pred)
  • 8
  • fill(to, to_end, value)
  • 19
  • all_of(begin, end, pred) 
  • 9
  • fill_n(to, n, value)
  • 20
  • any_of(begin, end, pred) 
  • 10
  • generate(to, to_end, gen)
  • 21
  • none_of(begin, end, pred) 
  • 11
  • generate_n(to, n, gen)
  • 22
  • count(first, end, value)

Standart algoritmlar

  • Nomi
  • Nomi
  • 1
  • count_if(first, end, pred)
  • 9
  • minmax_element(begin, end, comp) 
  • 2
  • search(a, a_end, s, s_end, eq)
  • 10
  • for_each(begin, end, fun)
  • 3
  • search_n(a, a_end, n, val, eq)
  • 11
  • transform(from, from_end, to, fun)
  • 4
  • find_end(begin, end, sub, sub_end, comp)
  • 12
  • transform(a, a_end, b, to, fun)
  • 5
  • find_first_of(begin, end, what, what_end, comp)
  • 13
  • replace(begin, end, old_val, new_val)
  • 6
  • adjacent_find(begin, end, comp)
  • 14
  • replace_if(begin, end, pred, new_val)
  • 7
  • mismatch(a, a_end, b, b_end, eq)
  • 15
  • replace_copy(begin, end, to, old_val, new_val)
  • 8
  • equal(a, a_end, b, b_end, eq)
  • 16
  • replace_copy_if(begin, end, to, pred, new_val)

Standart algoritmlar

  • Nomi
  • Nomi
  • 1
  • lexicographical_compare(a, a_end, b, b_end, comp)
  • 10
  • equal_range(begin, end, val, comp)
  • 2
  • max_element(begin, end, comp)
  • 11
  • partition(begin, end, pred)
  • 3
  • min_element(begin, end, comp)
  • 12
  • partition_copy(begin, end, true_begin, false_begin, pred)
  • 4
  • remove(begin, end, value)
  • 13
  • stable_partition(begin, end, pred)
  • 5
  • remove_if(begin, end, pred)
  • 14
  • partition_point(begin, end, pred)
  • 6
  • remove_copy(begin, end, to, val)
  • 15
  • is_partitioned(begin, end, pred)
  • 7
  • unique(begin, end, eq)
  • 16
  • is_permutation(a, a_end, b, b_end, eq)
  • 8
  • binary_search(begin, end, val, comp)
  • 17
  • next_permutation(begin, end, comp)
  • 9
  • lower_bound(begin, end, val, comp)
  • 18
  • upper_bound(begin, end, val, comp)

Standart algoritmlar

  • Nomi
  • Nomi
  • 1
  • prev_permutation(begin, end, comp)
  • 10
  • merge(a, a_end, b, b_end, to, comp)
  • 2
  • shuffle(begin, end, rng)
  • 11
  • includes(a, a_end, b, b_end, comp)
  • 3
  • sort(begin, end, comp)
  • 12
  • set_difference(a, a_end, b, b_end, to, comp)
  • 4
  • is_sorted(begin, end, comp)
  • 13
  • set_intersection(a, a_end, b, b_end, to, comp)
  • 5
  • is_sorted_until(begin, end, comp)
  • 14
  • set_union(a, a_end, b, b_end, to, comp)
  • 6
  • stable_sort(begin, end, comp)
  • 15
  • set_symmetric_difference(a, a_end, b, b_end, to, comp)
  • 7
  • partial_sort(begin, mid, end, comp)
  • 16
  • make_heap(begin, end, comp)
  • 8
  • partial_sort_copy(begin, end, to, to_end, comp)
  • 17
  • sort_heap(begin, end, comp)
  • 9
  • nth_element(begin, nth, end, comp)
  • 18
  • push_heap(begin, end, comp)

Standart algoritmlar va iteratorlardan foydalanib, amaliy dasturlar yaratish

  • Masala:
  • Matnli faylda N ta talabaning familiyasi, ismi va yoshi yozilgan. Ushbu ma’lumotlarni to’plamga o’zlashtirib yoshi bo’yicha saralovchi dastru tuzing.
  • Masalani yechish g‘oyasi:
  • Talaba haqida har xil turdagi ma’lumotlarni boshqarish uchun “Talaba” nomli struktura yaratiladi. istream_iterator iteratoridan foydalanib, matnli fayldan ma’lumotlar o’zlashtiriladi va ostream_iterator iteratoridan foydalanib, ma’lumotlarni matnli faylga yoki natijalar oynasiga chiqarish mumkin. Yosh bo’yicha saralash uchun sort(), ma’lumotlarni vector ga joylashtirish uchun copy(), ixtiyoriy yoshdan ixtiyoriy yoshgacha ma’lumotlarni chiqarish uchun copy_if() algoritmlaridan foydalaniladi. “Talaba” sun’iy tur bo’lganligi uchun kiritish va chiqarish oqimlari(>>, <<) qayta yuklanadi.

Dastur matni:

reverse_copy algoritmiga misol:

find(begin, end, value) algoritmiga misol:

mismatch(a, a_end, b, b_end, eq) algoritmiga misol:

max_element(begin, end, comp) va min_element(begin, end, comp) algoritmiga misol:

For_each(begin, end, fun) algoritmiga misol:

replace(begin, end, old_val, new_val) algoritmiga misol:

remove va remove_if(begin, end, pred) algorimiga misol:

sort(begin, end, comp) algoritmiga misol:

Foydalanilgan adabiyotlar

  • https://docs.microsoft.com/en-us/cpp/standard-library/priority-queue-class?view=vs-2019
  • https://docs.microsoft.com/en-us/cpp/standard-library/queue?view=vs-2019
  • https://teccxx.neocities.org/mx1/cifa.html

Xulosa

  • Ma’lum turdagi masalani yechish va uning dasturini ham tuzish mumkindir. Lekin keyinchalik shunga o’xshagan masalani yechish uchun konteynerlar yaratish va ularga ishlov beruvchi yordamchi funksiyalarni yaratish mushkul masa hisoblanadi.
  • Bunday vaziyatda konteynerlar aosida yaratilgan standart algoritmlar foydalaniladi.
  • C++ da 50 dan ortiq standart algoritmlar mavjud bo’lib, ular masalaning qo’yilishiga qarab tanlanadi.

Download 1,97 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10   11




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
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