Queue:
1, Queue<>q common operation:
(1) Q.front () take the first element of the team;
(2) q.pop () Delete the first element of the team;
(3) Q.empty () to determine whether the queue is empty;
(4) Q.push () insert an element into the queue and plug it into the tail of the team
2, Deque<>q (bidirectional queue) Common operations:
(1) Q.empty () to determine whether the column is empty;
(2) Q.front () to get the first element of the team;
(3) Q.back () get the tail element of the team;
(4) q.pop_back () delete team tail element;
(5) Q.pop_front () Delete the first element of the team;
(6) Q.push_back () inserts an element into the tail of the team;
(7) Q.push_front () inserts an element into the head of the team;
3, Priority_queue<>q (priority queue) common operations:
(1) Q.top () take the first element of the team;
(2) q.pop () Delete the first element of the team;
(3) Q.push () inserts an element into the queue (automatically sorted by priority);
(4) Q.empty () to determine whether the queue is empty;
(5) Priority_queue<int, vector<int>,greater<int> >Q; (Small top heap)
(6) Priority_queue<int, vector<int>,less<int> >Q; (Large top pile)
Collection: The collection is actually a red-black tree, the elements inside are arranged according to priority;
1, Set<>s (will not appear the same element) common operations:
(1) S.insert () inserts an element;
(2) S.erase () deletes an element;
(3) S.count () determines the number of occurrences of an element in the collection (1 is present and 0 is not);
(4) S.find () finds an element in the collection and returns an iterator pointer (not found when returning s.end ());
(5), s.clear () empty the set;
2, Multiset<>s (multiple sets, allowing the same element to appear) common operations and set<>s similar;
Variable-length array vector<>g:
Common operations:
(1), G.push_back () inserts an element;
(2), g.clear () empty G;
(3), G[i] get the first element (I starting from 0);
(4), g.size () The current length of variable length array;
(5), Sort (G.begin (), G.end (),less<int> ()) from small to large sort;
(6), Sort (G.begin (), G.end (),greater<int> ()) sorted from large to small;
Stack: stack<>s Common operations:
(1), S.push () the stack into an element;
(2), S.top () get top element of stack;
(3), S.pop () pop-up stack top element;
(4), S.empty () whether the stack is empty;
Map<>g commonly used mapping relationship <int, int>,<string,int>,<char,int>; common operations:
(1), g.clear () empty;
(2), G.count () returns the number of occurrences of a keyword;
The elements in the map are sorted according to the key word;
String str common usage:
(1), str.length ()/str.size () Gets the length of the string;
(2), Str.find () to find a segment of a string or a letter, return the first occurrence of the subscript, does not return 1; (the argument can be a character, a string, or three parameters that represent looking from a particular segment)
(3), STR.SUBSTR () gets a substring of the string, the parameter can be an integer pos, returns the substring at the end of the POS, or two integers, and returns a substring between the two integers;
Sort () by keyword;
BOOL CMP (int a, int b) {
return a < b;
}
Lower_bound (a,a+n,x) array A to A+n value greater than the first element equal to X;
Unique (a,a+n) to remove the repeated characters between adjacent (note is adjacent)
Next_permutation (A,a+n) to find the next arrangement;
string-related functions
The Strstr () function is used to retrieve the first occurrence of a substring in a string;
Its prototype is: Char *strstr (char *str, char * substr);
The STRRCHR () function is used to find the last occurrence of a character in a string;
Its prototype is: char * STRRCHR (const char *STR, int c);
STRCHR () is used to find the position of the first occurrence of a character in a string;
Its prototype is: char * STRCHR (const char *STR, int c);
Functions related to character processing
int tolower (int);
int toupper (int);
int isalpha (int);
int Iscntrl (int);
int isdigit (int);
isgraph (int);
int lslower (int);
int isalnum (int);
isprint (int);
ispunct (int); Whether it is a punctuation character
int isspace (int);
int isupper (int);
int isxdigit (int); Whether it is 16-in-system
C + + string operation
Char Number assembly string
Char s[];
string t = S;