কম্পিউটার টিউটোরিয়াল

C++-তে partition_point ফাংশন

এই টিউটোরিয়ালে C++-তে partition_point ফাংশন বোঝানো হয়েছে।

partition_point কী?

এটি একটি পার্টিশन्ड রেঞ্জে (যেখানে предиকেট সত্য হয় এমন এলিমেন্টগুলো আগে থাকে) প্রথম মিথ্যা প volvió এলিমেন্টের ইটারেটর ফেরত দেয়।

C++ প্রোগ্রাম

#include <iostream>
#include <algorithm>
#include <vector>

bool IsOdd(int i) { return (i % 2) == 1; }

int main() {
    vector<int> data{1,2,3,4,5,6,7,8,9,10};
    vector<int> odd, even;

    stable_partition(data.begin(), data.end(), IsOdd);
    auto it = partition_point(data.begin(), data.end(), IsOdd);

    odd.assign(data.begin(), it);
    even.assign(it, data.end());

    cout << "বিজোড়: ";
    for (int& x : odd) cout << ' ' << x;
    cout << "\nজোড়: ";
    for (int& x : even) cout << ' ' << x;
    cout << '\n';
    return 0;
}

আউটপুট

বিজোড়: 1 3 5 7 9
জোড়: 2 4 6 8 10
  1. C++-এ ডায়াগোনাল ট্রায়ভার্স II

  2. প্রসেস কিল করা (Kill Process) C++-এ

  3. স্কোয়ারেল সিমুলেশন (Squirrel Simulation) C++-এ

  4. C++-এ আয়তাকার এলাকা II (Rectangle Area II) সমাধান