STL
- SET
Intialization
SET
set<int> myset;
SET Iterator
set<int>::iterator it;
Insertion in SET
myset.insert(value);
Deletion in SET
myset.erase(value);
|
it=myset.find(value)
myset.erase(it,myset.end()); //to remove all element >=value
Traversing in SET
for(it=myset.begin();it!=myset.end();it++)
cout<<(*it);
Lower_bound in SET
it=myset.lower_bound(value);
//return an index >=value.
Upper_bound in SET
it=myset.upper_bound(value);
//return an index >value.
//Note if there is no answer >=value then it return the iterator to my.end();
String Operation
string h;
h.find(“-”); //return the index where the charater is found.
h.erase(pos,number_of_character_to_be_erased);
h.erase(pos);//erase the character in that index
No comments:
Post a Comment