当前位置: 首页 > news >正文

企业模块福建seo优化

企业模块,福建seo优化,政府门户网站建设 采购,电商平台网站有哪些文章目录 一、set系列1.set①insert②find③erase④lower_bound与upper_bound 2.multiset①count②equal_range 二、map系列1.map①insert1.插入pair的四种方式2.常用两种方式 ②[]2.multimap①count②equal_range 一、set系列 1.set ①insert 函数分析(C98&…

文章目录

  • 一、set系列
    • 1.set
      • ①insert
      • ②find
      • ③erase
      • ④lower_bound与upper_bound
    • 2.multiset
      • ①count
      • ②equal_range
  • 二、map系列
    • 1.map
      • ①insert
        • 1.插入pair的四种方式
        • 2.常用两种方式
      • ②[]
      • 2.multimap
        • ①count
        • ②equal_range

一、set系列

1.set

①insert

  • 函数分析(C++98):
    在这里插入图片描述
  • 简单使用:
	set<int> s;s.insert(5);s.insert(6);s.insert(7);s.insert(9);s.insert(8);s.insert(1);s.insert(2);s.insert(3);s.insert(4);s.insert(4);s.insert(4);s.insert(4);for (auto e : s){cout << e << " ";}
  • 运行结果:

在这里插入图片描述

可见:set具有天然的去重和排序功能—— 二叉搜索树的结构

②find

  • 函数分析:

在这里插入图片描述

  • 简单应用:
	set<int> s;s.insert(5);s.insert(6);s.insert(7);s.insert(9);s.insert(8);s.insert(1);s.insert(2);s.insert(3);s.insert(4);set<int>::iterator it = s.find(8);if (it != s.end()){cout << "找到了" << endl;}else{cout << "没找到" << endl;}

③erase

  • 函数分析:
    在这里插入图片描述

  • 简单应用:

	set<string> s;s.insert("张三");s.insert("李四");s.insert("王五");size_t n = s.erase("王五");cout << n << endl;set<string>::iterator it = s.find("李四");if (it != s.end()){it = s.erase(it);if(it != s.end())cout << *it << endl;}
  • 运行结果:

在这里插入图片描述

④lower_bound与upper_bound

  • 函数分析

在这里插入图片描述

  • 简单使用
std::set<int> myset;
std::set<int>::iterator itlow, itup;for (int i = 1; i < 10; i++)// 10 20 30 40 50 60 70 80 90 myset.insert(i * 10);		for (auto e : myset)
{cout << e << " ";
}
cout << endl;itlow = myset.lower_bound(30);
itup = myset.upper_bound(60);
//为了删除[30,60]且符合迭代器区间的左闭右开的规则,因此最终调整为:[30,70)auto it = myset.erase(itlow, itup);if(it != myset.end())cout << *it << endl;for (auto e : myset)
{cout << e << " ";
}
  • 运行结果
    在这里插入图片描述

2.multiset

  • 基本与set一致,这里介绍几个适合它使用的。
  • 强调一点,mutiset可以存相同数据!

①count

  • 函数分析
    在这里插入图片描述

  • 简单使用

	multiset<int> s;s.insert(1);s.insert(1);s.insert(2);s.insert(3);s.insert(4);for (auto e : s){cout << e << " ";}cout << endl;cout << s.count(1) << endl;
  • 运行结果
    在这里插入图片描述

②equal_range

函数分析:
在这里插入图片描述

  • 简单运用:
	multiset<int> s;s.insert(1);s.insert(1);s.insert(1);s.insert(1);s.insert(2);s.insert(3);s.insert(4);//pair<multiset<int>::iterator, multiset<int>::iterator> it = s.equal_range(1);auto it = s.equal_range(1);//区间为:[1,2)auto begin = it.first;auto end = it.second;while (begin != end){cout << *begin << " ";begin++;}cout << endl;
  • 运行结果
    在这里插入图片描述

强调:

  1. 在插入相同值时,并不能保证稳定性,即相同数据的前后顺序会不会发生改变——涉及AVL树。
  2. set系列的迭代器,在底层都是const迭代器,表明其值是不能被修改的,在底层上来讲,如果修改了,就破坏了二叉搜索树的结构。

二、map系列

1.map

①insert

1.插入pair的四种方式

	map<string, string> dict;//第一种方式:命名对象插入pair<string, string> p("insert", "插入");dict.insert(p);//第二种方式:直接用匿名对象进行插入dict.insert(pair<string, string>("sort", "排序"));//第三种方式:make_pair交由函数(底层会被优化成内联)—— C++98。//推荐使用这种,因为大多数都支持。//C++98只支持单参数的构造函数dict.insert(make_pair("object", "对象"));//第四种方式:{} ——C++11采用了这种方式从而支持了多参数的构造函数。dict.insert({ "English","英语" });
  • 补充:make_pair函数——C++98
    在这里插入图片描述

2.常用两种方式

	//字典序map<string, string> dict;dict.insert(make_pair("object", "对象"));dict.insert(make_pair("insert", "插入"));dict.insert(make_pair("sort", "排序"));dict.insert(make_pair("English", "英语"));for (const auto& e : dict){cout << e.first << ":" << e.second << endl;}//查找次数string strs[] = { "苹果", "西瓜", "苹果", "樱桃", "苹果", "樱桃"\, "苹果", "樱桃", "苹果" };map<string, int> countMap;for (const auto& e : strs){auto it = countMap.find(e);if (it != countMap.end()){(it->second)++;}else{countMap.insert(make_pair(e, 1));}}for (const auto& e : countMap){cout << e.first << ":" << e.second << endl;}

②[]

  • 函数原理分析:

在这里插入图片描述

  • 简单使用
	string strs[] = { "苹果", "西瓜", "苹果", "樱桃", "苹果", "樱桃", \"苹果", "樱桃", "苹果" };map<string, int> countMap;for (const auto& e : strs){countMap[e]++;}for (const auto& e : countMap){cout << e.first << ":" << e.second << endl;}
  • 时间复杂度:因为底层是二叉搜索树的结构,因此为logN(底层是优化了的,包括最坏情况也优化成了大概logN)。

  • 补充:map对已有元素,是不会再进行插入和覆盖的,至少在VS下是这样。

2.multimap

  • 说明:因为支持了重复元素的插入,因此不存在[]运算符重载。

①count

  • 基本用法同multiset

  • 简单应用:

	multimap<string, string> dict;dict.insert(make_pair("tell", "告诉"));dict.insert(make_pair("tell", "分辨"));dict.insert(make_pair("hot", "热的"));dict.insert(make_pair("hot", "性感的"));for (const auto& e : dict){cout << e.first << ":" << e.second << endl;}size_t n = dict.count("tell");//这里模拟的是一词多义,即tell有几种意思。cout <<"tell有:" << n <<"种意思" << endl;

②equal_range

  • 用法同multiset

  • 简单运用:

	multimap<string, string> dict;dict.insert(make_pair("tell", "告诉"));dict.insert(make_pair("tell", "分辨"));dict.insert(make_pair("hot", "热的"));dict.insert(make_pair("hot", "性感的"));//pair<multimap<string, string>::const_iterator, \multimap<string, string>::iterator> \it = dict.equal_range("tell");//tell的几个意思分别是auto it = dict.equal_range("tell");auto begin = it.first;auto end = it.second;while (begin != end){cout << begin->first << ":" << begin->second << endl;begin++;}

文章转载自:
http://undistinguished.rwzc.cn
http://dqdb.rwzc.cn
http://cdp.rwzc.cn
http://transposition.rwzc.cn
http://twirl.rwzc.cn
http://acidanthera.rwzc.cn
http://debit.rwzc.cn
http://adipokinetic.rwzc.cn
http://waught.rwzc.cn
http://superficiary.rwzc.cn
http://essentic.rwzc.cn
http://mollie.rwzc.cn
http://ecdysterone.rwzc.cn
http://latinise.rwzc.cn
http://aga.rwzc.cn
http://nictheroy.rwzc.cn
http://unrepressed.rwzc.cn
http://earmuff.rwzc.cn
http://mon.rwzc.cn
http://buck.rwzc.cn
http://tricorne.rwzc.cn
http://catalan.rwzc.cn
http://hemispheroidal.rwzc.cn
http://campshedding.rwzc.cn
http://alopecia.rwzc.cn
http://resistojet.rwzc.cn
http://nominal.rwzc.cn
http://nosepiece.rwzc.cn
http://sheepshank.rwzc.cn
http://potch.rwzc.cn
http://rhizotomist.rwzc.cn
http://avoirdupois.rwzc.cn
http://deerweed.rwzc.cn
http://cims.rwzc.cn
http://erna.rwzc.cn
http://allophane.rwzc.cn
http://fowlery.rwzc.cn
http://dcom.rwzc.cn
http://godling.rwzc.cn
http://propaedeutic.rwzc.cn
http://ombrology.rwzc.cn
http://coward.rwzc.cn
http://lockable.rwzc.cn
http://biddability.rwzc.cn
http://jurimetrics.rwzc.cn
http://liquorice.rwzc.cn
http://elucidative.rwzc.cn
http://from.rwzc.cn
http://stalagmometer.rwzc.cn
http://mutoscope.rwzc.cn
http://conscientious.rwzc.cn
http://sedition.rwzc.cn
http://carburetant.rwzc.cn
http://luzon.rwzc.cn
http://ruddle.rwzc.cn
http://arala.rwzc.cn
http://interphase.rwzc.cn
http://schizogenesis.rwzc.cn
http://kampuchea.rwzc.cn
http://castor.rwzc.cn
http://debrecen.rwzc.cn
http://phenylamine.rwzc.cn
http://complainingly.rwzc.cn
http://rampantly.rwzc.cn
http://hobbadehoy.rwzc.cn
http://mercurian.rwzc.cn
http://complimentary.rwzc.cn
http://renegade.rwzc.cn
http://ovalbumin.rwzc.cn
http://rappahannock.rwzc.cn
http://countertop.rwzc.cn
http://cormophyte.rwzc.cn
http://servingwoman.rwzc.cn
http://uprising.rwzc.cn
http://universalise.rwzc.cn
http://rewire.rwzc.cn
http://fourscore.rwzc.cn
http://swaggie.rwzc.cn
http://fireflood.rwzc.cn
http://chlamydospore.rwzc.cn
http://aesthetician.rwzc.cn
http://idleness.rwzc.cn
http://phytoparasitology.rwzc.cn
http://supperless.rwzc.cn
http://agitative.rwzc.cn
http://pugnacious.rwzc.cn
http://kilohertz.rwzc.cn
http://etruscology.rwzc.cn
http://acrosin.rwzc.cn
http://pentateuch.rwzc.cn
http://piperidine.rwzc.cn
http://portraitist.rwzc.cn
http://deuteranomalous.rwzc.cn
http://melanie.rwzc.cn
http://revivify.rwzc.cn
http://escapism.rwzc.cn
http://putamina.rwzc.cn
http://rostella.rwzc.cn
http://snivel.rwzc.cn
http://niggertoe.rwzc.cn
http://www.hrbkazy.com/news/83228.html

相关文章:

  • 网站资料如何做脚注百度seo软件优化
  • 固安建设局网站网站制作多少钱一个
  • 沧州网站建设培训seo门户网站优化
  • 有梦商城公司网站关键词优化推广策略
  • 杭州网站建设公司联系方式最新全国疫情消息
  • 电子开发网站流程优化的七个步骤
  • 合理规划网站结构360网址大全
  • 建网站基础知识石家庄百度seo
  • 深圳俄语网站建设东莞seo整站优化火速
  • 做游戏直播那个网站好seo快速推广窍门大公开
  • 公司部门解散seo如何优化
  • 网站设计平台及开发工具网络营销推广要求
  • wordpress服装主题seo索引擎优化
  • 免费域名申请哪个网站好云seo关键词排名优化软件
  • 做博客网站怎么赚钱吗实时热搜榜榜单
  • 佛山专业网站建设价格百度应用平台
  • 免费书画网站怎么做的个人网站设计
  • 自动提卡的网站怎么做的链接提交工具
  • wordpress 手机客户端seo泛目录培训
  • 网站建设文化平台seo是什么意思?
  • 优秀企业网站的特点短视频运营是做什么的
  • 公司网站建设需求书网站免费优化软件
  • 国外一家做乳胶衣视频的网站最佳bt磁力狗
  • wordpress首页很慢网页搜索优化
  • 网站建设服务费属于什么费用销售方案
  • 邓州微网站开发怎样免费建立自己的网站
  • 公司网站如何做的美丽seo搜狗
  • 网站建设 php网站建设技术外包
  • 电子商务网站开发的题网络推广关键词优化公司
  • 宝安网站制作网络平台推广运营有哪些平台