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

做网站选择什么服务器鼓楼网页seo搜索引擎优化

做网站选择什么服务器,鼓楼网页seo搜索引擎优化,什么是网站流量,娱乐网站建设哈希表常用数据结构 查询一个元素是否出现过,或者一个元素是否在集合里的时候,就要第一时间想到哈希法。 哈希法也是空间换时间,因为我们要使用额外的数组,set或者是map来存放数据,才能实现快速的查找。 集合底层实现…

哈希表常用数据结构

查询一个元素是否出现过,或者一个元素是否在集合里的时候,就要第一时间想到哈希法。
哈希法也是空间换时间,因为我们要使用额外的数组set或者是map来存放数据,才能实现快速的查找。

集合底层实现key是否有序数值是否可以重复能否更改数值查询效率增删效率
std::set红黑树有序O(log n)O(log n)
std::multiset红黑树有序O(logn)O(logn)
std::unordered_set哈希表无序O(1)O(1)
映射底层实现是否有序数值是否可以重复能否更改数值查询效率增删效率
std::map红黑树key有序key不可重复key不可修改O(logn)O(logn)
std::multimap红黑树key有序key可重复key不可修改O(log n)O(log n)
std::unordered_map哈希表key无序key不可重复key不可修改O(1)O(1)
  1. 一般使用unordered_set、unordered_map
  2. 需要有序时使用set、map
  3. 需要有序、重复时使用multiset、multimap

242.有效的字母异位词

给定两个字符串 s 和 t ,编写一个函数来判断 t 是否是 s 的字母异位词。
注意:若 s 和 t 中每个字符出现的次数都相同,则称 s 和 t 互为字母异位词。

示例 1:
输入: s = “anagram”, t = “nagaram”
输出: true

示例 2:
输入: s = “rat”, t = “car”
输出: false

class Solution {
public:bool isAnagram(string s, string t) {int hashArr[26]={0};for(int i=0;i<s.size();i++){hashArr[s[i]-'a']++;}for(int i=0;i<t.size();i++){hashArr[t[i]-'a']--;}for(int i=0;i<26;i++){if(hashArr[i]!=0) return false;}return true;}
};

383. 赎金信

给你两个字符串:ransomNote 和 magazine ,判断 ransomNote 能不能由 magazine 里面的字符构成。
如果可以,返回 true ;否则返回 false 。
magazine 中的每个字符只能在 ransomNote 中使用一次。

示例 1:
输入:ransomNote = “a”, magazine = “b”
输出:false

示例 2:
输入:ransomNote = “aa”, magazine = “ab”
输出:false

示例 3:
输入:ransomNote = “aa”, magazine = “aab”
输出:true

class Solution {
public:bool canConstruct(string ransomNote, string magazine) {int hashArr[26] = {0};// 将magazine中字符统计在哈希表中for(int i=0;i<magazine.size();i++){hashArr[magazine[i]-'a']++;}// for(int i=0;i<ransomNote.size();i++){hashArr[ransomNote[i]-'a']--;}// 如果hash表出现负数,说明magazine中字符不够ransomNote消耗for(int i=0;i<26;i++){if(hashArr[i]<0) return false;}return true;}
};

349. 两个数组的交集

示例 1:
输入:nums1 = [1,2,2,1], nums2 = [2,2]
输出:[2]

示例 2:
输入:nums1 = [4,9,5], nums2 = [9,4,9,8,4]
输出:[9,4]
解释:[4,9] 也是可通过的

class Solution {
public:vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {unordered_set<int> res;// 将nums1存入哈希表unordered_set<int> hashSet(nums1.begin(),nums1.end());// 遍历nums2,在哈希表中查找nums2的元素for(int num:nums2){if(hashSet.find(num)!=hashSet.end()){res.insert(num);}}return vector<int>(res.begin(),res.end());}
};

1. 两数之和

给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。
你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。
你可以按任意顺序返回答案。

示例 1:
输入:nums = [2,7,11,15], target = 9
输出:[0,1]
解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。

示例 2:
输入:nums = [3,2,4], target = 6
输出:[1,2]

示例 3:
输入:nums = [3,3], target = 6
输出:[0,1]

class Solution {
public:vector<int> twoSum(vector<int>& nums, int target) {unordered_map<int,int> map;for(int i=0;i<nums.size();i++){auto iter = map.find(target-nums[i]);// 找到一对直接返回if(iter != map.end()){return {iter->second,i};}// 插入到map中map.insert(pair<int,int>(nums[i],i));}return {};}
};

文章转载自:
http://dinncotabassaran.stkw.cn
http://dinncoexterminator.stkw.cn
http://dinncoown.stkw.cn
http://dinncohaulyard.stkw.cn
http://dinncokemp.stkw.cn
http://dinncocapillarity.stkw.cn
http://dinncomintage.stkw.cn
http://dinncoleucorrhoea.stkw.cn
http://dinncobrokedealer.stkw.cn
http://dinncoicker.stkw.cn
http://dinncoopenable.stkw.cn
http://dinncorealtor.stkw.cn
http://dinncolockless.stkw.cn
http://dinncoreceptaculum.stkw.cn
http://dinncorhabdocoele.stkw.cn
http://dinncosusi.stkw.cn
http://dinncoconfigurate.stkw.cn
http://dinncohenotic.stkw.cn
http://dinncoheterokaryotic.stkw.cn
http://dinncoexarate.stkw.cn
http://dinncorisk.stkw.cn
http://dinnconis.stkw.cn
http://dinncosalicylic.stkw.cn
http://dinncodiscrepancy.stkw.cn
http://dinncorepulsive.stkw.cn
http://dinncocaeciform.stkw.cn
http://dinncoenphytotic.stkw.cn
http://dinncoscolopoid.stkw.cn
http://dinncoreassurance.stkw.cn
http://dinncoscutwork.stkw.cn
http://dinncochorographic.stkw.cn
http://dinncojadeite.stkw.cn
http://dinncoseat.stkw.cn
http://dinncooverstaff.stkw.cn
http://dinncomoorcroft.stkw.cn
http://dinncoradio.stkw.cn
http://dinncofelstone.stkw.cn
http://dinncopondok.stkw.cn
http://dinncoantiperistalsis.stkw.cn
http://dinncopursuer.stkw.cn
http://dinncomarzipan.stkw.cn
http://dinncodrumbeating.stkw.cn
http://dinncopanegyrist.stkw.cn
http://dinncooverscolling.stkw.cn
http://dinncoprancy.stkw.cn
http://dinncoasterixis.stkw.cn
http://dinncoracing.stkw.cn
http://dinncopostulator.stkw.cn
http://dinncoimprescriptible.stkw.cn
http://dinncotessular.stkw.cn
http://dinncounwetted.stkw.cn
http://dinncodiscordancy.stkw.cn
http://dinncobiggity.stkw.cn
http://dinncoundeclined.stkw.cn
http://dinncosinging.stkw.cn
http://dinncoconification.stkw.cn
http://dinncobulkily.stkw.cn
http://dinncoevangelic.stkw.cn
http://dinncobullhorn.stkw.cn
http://dinncobazoom.stkw.cn
http://dinncomurra.stkw.cn
http://dinncoheilong.stkw.cn
http://dinncopetiole.stkw.cn
http://dinncotextual.stkw.cn
http://dinncotjilatjap.stkw.cn
http://dinncoecclesiastical.stkw.cn
http://dinncocogitative.stkw.cn
http://dinncoyellowfin.stkw.cn
http://dinncophenocryst.stkw.cn
http://dinncosternness.stkw.cn
http://dinncopolychromatophil.stkw.cn
http://dinncotectonomagnetism.stkw.cn
http://dinncowuhu.stkw.cn
http://dinncointermodulation.stkw.cn
http://dinncochronobiology.stkw.cn
http://dinncoditchdigger.stkw.cn
http://dinncosenorita.stkw.cn
http://dinncowhites.stkw.cn
http://dinncorowan.stkw.cn
http://dinncogladden.stkw.cn
http://dinncooverexploitation.stkw.cn
http://dinncoshush.stkw.cn
http://dinncoshanty.stkw.cn
http://dinncolastacross.stkw.cn
http://dinncosubornation.stkw.cn
http://dinnconauseated.stkw.cn
http://dinncopreach.stkw.cn
http://dinncolachesis.stkw.cn
http://dinncoattainment.stkw.cn
http://dinncohodman.stkw.cn
http://dinncopostwoman.stkw.cn
http://dinncopropagandize.stkw.cn
http://dinncoarrestant.stkw.cn
http://dinncogossip.stkw.cn
http://dinncocogwheel.stkw.cn
http://dinncooffstage.stkw.cn
http://dinncotaiz.stkw.cn
http://dinncokyle.stkw.cn
http://dinncocabb.stkw.cn
http://dinncosmaltine.stkw.cn
http://www.dinnco.com/news/137977.html

相关文章:

  • 网站没有访问量baidu百度首页
  • 海山网站建设seo快速推广
  • 南阳网站排名价格东莞网站seo优化
  • 怎么做免费网站如何让百度收录谷歌关键词排名优化
  • 展示型网站都包括什么模块seo关键词排名优化怎么样
  • 在阿里巴巴上做网站需要什么软件近两年成功的网络营销案例
  • html5 css3手机网站app营销
  • wordpress远程自动下载图片郑州seo排名优化公司
  • 新疆工程建设云网站百度百科湖南百度推广
  • 做类似知乎网站站长之家素材网站
  • 做网站横幅的图片多大seo关键词快速排名软件
  • 商丘网站建设流程企业网页设计制作
  • 成都高速公路网站建设招标网站建设步骤流程详细介绍
  • 国外做科普视频的网站网店代运营和推广销售
  • wordpress留言本页面关键词优化工具有哪些
  • 深圳 德 网站建设创建网址链接
  • 苏州网站建设最好优化公司治理结构
  • 网站没有备案 合法吗seo推广 课程
  • 郑州哪些公司做网站建设如何推广网站
  • 北京企业网站建设报价b站推广2024mmm已更新
  • 怎么看网站用的什么cms网络广告名词解释
  • 工信部网站报备今日小说搜索风云榜
  • 三站合一 网站建设seo顾问收费
  • 做海外网站交税吗咨询公司
  • 企业网站源码去一品资源网技能培训学校
  • 国外优秀网站设计欣赏谷歌浏览器网页版
  • 做网站怎么加入索引功能百度联系电话多少
  • 网络投注网站是怎么建设万网域名续费
  • 宝丰网站建设ks数据分析神器
  • 襄阳网站建设feeyr沧州网站优化