| | | | | | | | | - copy_if(from, from_end, to, pred)
| | - reverse_copy(from, from_end, to)
| | | | - rotate(begin, new_begin, end)
| | - copy_backward(from, from_end, to_end)
| | - rotate_copy(from, new_begin, from_end, to)
| | | | | | - move_backward(from, from_end, to_end)
| | - find_if(begin, end, pred)
| | | | - find_if_not(begin, end, pred)
| | | | | | | | | | - generate(to, to_end, gen)
| | - none_of(begin, end, pred)
| | | | | Standart algoritmlar | | | | | - count_if(first, end, pred)
| | - minmax_element(begin, end, comp)
| | - search(a, a_end, s, s_end, eq)
| | - for_each(begin, end, fun)
| | - search_n(a, a_end, n, val, eq)
| | - transform(from, from_end, to, fun)
| | - find_end(begin, end, sub, sub_end, comp)
| | - transform(a, a_end, b, to, fun)
| | - find_first_of(begin, end, what, what_end, comp)
| | - replace(begin, end, old_val, new_val)
| | - adjacent_find(begin, end, comp)
| | - replace_if(begin, end, pred, new_val)
| | - mismatch(a, a_end, b, b_end, eq)
| | - replace_copy(begin, end, to, old_val, new_val)
| | - equal(a, a_end, b, b_end, eq)
| | - replace_copy_if(begin, end, to, pred, new_val)
| Standart algoritmlar | | | | | - lexicographical_compare(a, a_end, b, b_end, comp)
| | - equal_range(begin, end, val, comp)
| | - max_element(begin, end, comp)
| | - partition(begin, end, pred)
| | - min_element(begin, end, comp)
| | - partition_copy(begin, end, true_begin, false_begin, pred)
| | - remove(begin, end, value)
| | - stable_partition(begin, end, pred)
| | - remove_if(begin, end, pred)
| | - partition_point(begin, end, pred)
| | - remove_copy(begin, end, to, val)
| | - is_partitioned(begin, end, pred)
| | | | - is_permutation(a, a_end, b, b_end, eq)
| | - binary_search(begin, end, val, comp)
| | - next_permutation(begin, end, comp)
| | - lower_bound(begin, end, val, comp)
| | - upper_bound(begin, end, val, comp)
| Standart algoritmlar | | | | | - prev_permutation(begin, end, comp)
| | - merge(a, a_end, b, b_end, to, comp)
| | | | - includes(a, a_end, b, b_end, comp)
| | | | - set_difference(a, a_end, b, b_end, to, comp)
| | - is_sorted(begin, end, comp)
| | - set_intersection(a, a_end, b, b_end, to, comp)
| | - is_sorted_until(begin, end, comp)
| | - set_union(a, a_end, b, b_end, to, comp)
| | - stable_sort(begin, end, comp)
| | - set_symmetric_difference(a, a_end, b, b_end, to, comp)
| | - partial_sort(begin, mid, end, comp)
| | - make_heap(begin, end, comp)
| | - partial_sort_copy(begin, end, to, to_end, comp)
| | - sort_heap(begin, end, comp)
| | - nth_element(begin, nth, end, comp)
| | - push_heap(begin, end, comp)
| - 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.
Do'stlaringiz bilan baham: |