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

সি++ STL-এ মাল্টিসেট lower_bound() উদাহরণসহ (multiset lower_bound() in C++ STL with Examples)


এই টিউটোরিয়ালে, আমরা সি++ STL-এ মাল্টিসেট lower_bound() ফাংশন সম্পর্কে আলোচনা করব।

lower_bound() ফাংশনটি কন্টেইনারে দেওয়া প্যারামিটারের সমতুল্য এলিমেন্টের প্রথম অস্তিত্ব রিটার্ন করে, না থাকলে সেটির চেয়ে বড় এলিমেন্টটি রিটার্ন করে।

উদাহরণ

#include <bits/stdc++.h> using namespace std; int main(){    multiset<int> s;    s.insert(1);    s.insert(2);    s.insert(2);    s.insert(1);    s.insert(4);    cout << "The multiset elements are: ";    for (auto it = s.begin(); it != s.end(); it++)       cout << *it << " ";    auto it = s.lower_bound(2);    cout << "\nThe lower bound of key 2 is ";    cout << (*it) << endl;    it = s.lower_bound(3);    cout << "The lower bound of key 3 is ";    cout << (*it) << endl;    it = s.lower_bound(7);    cout << "The lower bound of key 7 is ";    cout << (*it) << endl;    return 0; }

আউটপুট

The multiset elements are: 1 1 2 2 4 The lower bound of key 2 is 2 The lower bound of key 3 is 4 The lower bound of key 7 is 5

  1. C++ STL-এ multiset insert() ফাংশন ব্যবহার

  2. C++ STL-এ Vector বাস্তবায়ন: ডাইনামিক অ্যারে ব্যবহার

  3. C++ STL-এ Multiset বাস্তবায়ন: ডুপ্লিকেট অনুমোদিত সেট

  4. C++ STL-এ List বাস্তবায়ন: ডাবলি লিংকড লিস্ট