当前位置:网站首页>STL set container
STL set container
2022-07-24 03:23:00 【joker_ 0030】
#include <set>
#include <string>
#include<iostream>
using namespace std;
int main()
{
set<string> db;
db.insert(string("abs"));
db.insert(string("abd"));
db.insert(string("abe"));
db.insert(string("abc"));
db.insert(string("aba"));
// Delete .
db.erase(string("abe"));
//db.erase("abe");
// Iterator output
set<string>::iterator ite = db.begin();
for ( ite; ite !=db.end(); ite++)
{
cout << *ite<<endl;
}
system("pause");
return 0;
}
set:
1、 Keyword save : Sort by actual value , Find by actual value ;
characteristic :a、 Efficient access , contrast map:
1、 The data structure is a red black tree ;
2、map It is a sub key value pair ,set The key value is the actual value , The actual value is the key value .
b、 Key values cannot be repeated .
2、 Red and black trees ( Balance Sort binary trees ):x=log2^N:
a、N Is the total amount of data .
b、x Is the number of lookups ,2^x>=N.
3、 Key value cannot be changed , The actual value can be changed . But generally, modifying the actual value means that modifying the key value will change the whole structure , Generally, modification is not advocated .
4、 No capacity ; Get the number of elements ,size(), Size ; Get whether an element exists , Or judge whether an element exists , count(const key&_key); Determine whether it is empty empty(), Empty return 1, Not empty return 0; iterator , It can cycle 、 You can also add it yourself ++, But not +2.
边栏推荐
- The error of van swipe in the rotation chart: cannot read a properties of null (reading width)
- JS 数组 isAarray() typeof
- Open source embedded sig in the openeuler community. Let's talk about its multi OS hybrid deployment framework
- What is the security of Treasury reverse repo
- Express内置的中间件
- SolidWorks cannot reference references
- Unity message push
- FTP服務與配置
- Android开发——Kotlin语法之Lambda表达式
- Programmers may still be programmers, and coders may only be coders
猜你喜欢

The next stop of data visualization platform | gifts from domestic open source data visualization datart "super iron powder"

In the future, when the interviewer asks why you don't recommend using select *, please answer him loudly!

Do you know how to do interface testing well?

Tweenmax+svg Pikachu transformation ball
![SSM based blog system [with background management]](/img/6b/6a488f5d6926de07c8b1b365362ff6.png)
SSM based blog system [with background management]

SolidWorks CAM data cannot be recovered because a processed part has been detected.

正則錶達式 \b \B 深入淺出理解單詞邊界的匹配

IO stream sorting

JIRA automation experience sharing for 2 years

I developed an app similar to wechat runnable applet with fluent
随机推荐
Acwing 4498. pointer (DFS)
leetcode hot 100(刷題篇8)(232/88/451/offer10/offer22/344/)
正則錶達式 \b \B 深入淺出理解單詞邊界的匹配
JMeter interview script
Gpushare.com | 如何使用TensorBoardX可视化工具?
Binary search
Hospital PACS source code PACS ultrasonic Department source code DICOM image workstation source code [source code free sharing]
Mobile keyboard (day 73)
Okaleido tiger NFT is about to log in to the binance NFT platform. Are you looking forward to it?
Using global data to realize data sharing in wechat applet
Android开发——Kotlin语法之Lambda表达式
Basic use of Pinia
FTP服務與配置
Generate 13 bit barcode
C动态内存管理详解
CMT registration - Google Scholar ID, semantic scholar ID, and DBLP ID
[super complete sorting] Cisco and Huawei order comparison memo, take it away without thanks! Anytime, anywhere
Jump statements break and continue
Hcip day 9 notes (OSPF routing feedback, routing policy, and Configuration Guide)
Cannot resolve symbol 'override' of idea clone‘