c How to use the collection

Updated on Financial 2024-03-19
4 answers
  1. Anonymous users2024-02-06

    Header files included:

    #include

    #include

    Set functions: sets1, s2;

    Insert an element 1

    Insert an element 2

    set::iterator site;Iterator, used in the same way as vector

    setsi;

    setvis

    set intersection( ,inserter( si, si is the set after the intersection.

    set_union(..And, the grammar is the same as above.

    set_difference(..Poor, the grammar is the same as above.

    Remove all elements from the set container.

    Returns the number of VIS with a median value of s.

    if( to determine whether s is in the set vis.

    Return the location of s, if you can't find it, return end(), which is vis,(s)== Add s to the collection.

    Remove s from the collection

    Output: set::iterator ii;

    for(ii=;ii!=;ii++)

    cout<<(ii)<<' ';

  2. Anonymous users2024-02-05

    It is recommended to use std::set--element that is not allowed to be duplicated, or std::multiset-element that is allowed to be duplicated. Both of these collections are very efficient.

    *Usage examples:

    std::setmyset;

    int a,b,c,d;

    a=1;a=2;

    a=3;a=4;;;

    erase(), find(), and size() are functions that delete, find, and find the number of elements.

    You may ask, why not just use arrays? The biggest advantage of std::set arrays is that the elements in the set are sorted by key values.

    If std::set encounters duplicate key values, only one value is saved; Whereas, std::multiset allows duplicate elements to exist side by side.

  3. Anonymous users2024-02-04

    Write the C++ program as you want to write and round the print of all subsets of the set with n elements as follows (see Figure Wu Pengxiang).

  4. Anonymous users2024-02-03

    Use recursive Ying Xun to get all the subsets of a set with n elements (C++ implementation)**Brief description of the topic: For example, there is a set, find all its subsetsAnalysis: In fact, this is a problem of permutations and combinations; The existence of each element is represented by 0,1, which is a permutation of 0,1, and put it in an array, which can be achieved recursively.

Related questions
8 answers2024-03-19

Inside the math set.

a=b means: >>>More

11 answers2024-03-19

There is no such name in textbooks at present, nor is it called when the set was first introduced. >>>More

11 answers2024-03-19

srand(int) is used to set the seed, and then returns a random value each time rand(). >>>More

8 answers2024-03-19

I haven't studied how to select this problem after finding it.,I don't know if richTextBox can be implemented.,If it's just a search, it shouldn't be difficult.。

4 answers2024-03-19

using system;

using ; >>>More