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

工信部网站备案查询步骤小程序开发一个多少钱啊

工信部网站备案查询步骤,小程序开发一个多少钱啊,网站如何做导航,浏览器无法访问网页怎么办引入 二叉查找树 二叉查找树(Binary Search Tree),又名二叉搜索树。满足以下性质: 对于非空的左子树,左子树点权值小于根节点。对于非空的右子树,左子树点权值大于根节点。二叉查找树的左右子树均是二叉…

引入

二叉查找树

二叉查找树(Binary Search Tree),又名二叉搜索树。满足以下性质:

  • 对于非空的左子树,左子树点权值小于根节点。
  • 对于非空的右子树,左子树点权值大于根节点。
  • 二叉查找树的左右子树均是二叉查找树。

平衡树

在维持二叉查找树性质的基础上,通过改变其形态,控制深度在 log ⁡ n \log n logn 级别。

平衡树左右两个子树高度差不大于 1 1 1,否则需要进行左旋 / 右旋操作。

pb_ds

C++pb_ds 中有封装好的平衡树。

tree 类型的平衡树常数稍大,速度略慢。

声明方式

有以下声明(来源于官方文档):

template<typename Key,typename Mapped,typename Cmp_Fn = std::less<Key>,typename Tag = rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update = null_tree_node_update,typename Allocator = std::allocator<char> >
class tree;

常用的定义方式为 tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

  • 第一个参数表示存储元素(Key)的类型;
  • 第二个参数表示映射规则(Mapped-Policy)的类型,常用的是 null_type,表示无映射;
  • 第三个参数表示比较规则(Cmp_Fn);
  • 第四个参数表示平衡树的类型(Tag),有 rb_tree_tag(红黑树)、splay_tree_tag 等;
  • 第五个参数表示更新节点的策略(Node_Update),默认为 null_node_update,如果要使用查询排名相关操作,需要使用 tree_order_statisitics_node_update

常用操作

其中 x 表示存储元素的类型。

  • insert(x):插入元素 x x x
  • erase(x):删除元素 x x x
  • order_of_key(x):查询元素 x x x 的排名(前面有多少数比 x x x 小),返回值为整数。
  • find_by_order(x):查询排名为 x x x 的元素对应的迭代器。
  • lower_bound(x)upper_bound(x):返回迭代器。
  • join(x):将 x x x 树并入当前树,要求两树值域不能重叠。合并后 x x x 树被清空。
  • split(x,b):小于等于 x x x 的属于当前树,其余的属于 b b b 树。
  • size():返回大小。

以下是 P3369 【模板】普通平衡树 的代码。

注意用 pb_ds 实现的 tree 类似于一个 set,元素是不可重的。所以我们把元素以 pair 的形式存储,再记录一个元素被插入到 tree 的时间。

prev(it) 函数可以求迭代器 it 的前驱(即前一个位置)。注意求 x x x 的后继时,用 upper_bound() 操作的键值对应该是 pair<x,INT_MAX>,避免查找到和 x x x 相等但插入时间比 x x x 晚的元素。

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;tree<pair<int,int>,null_type,less<pair<int,int> >,rb_tree_tag,tree_order_statistics_node_update> t;int main()
{int n;cin>>n;for(int i=1;i<=n;i++){int op,x;cin>>op>>x;if(op==1) t.insert({x,i});if(op==2) t.erase(t.upper_bound({x,0}));if(op==3) cout<<t.order_of_key({x,0})+1<<endl;if(op==4){auto it=t.find_by_order(x-1);cout<<(*it).first<<endl;}if(op==5){auto it=prev(t.lower_bound({x,0}));cout<<(*it).first<<endl;}if(op==6){auto it=t.upper_bound({x,INT_MAX});cout<<(*it).first<<endl;}}return 0;
}

文章转载自:
http://basketry.gcqs.cn
http://oodm.gcqs.cn
http://shastra.gcqs.cn
http://falstaff.gcqs.cn
http://martyrology.gcqs.cn
http://faucial.gcqs.cn
http://pie.gcqs.cn
http://proboscidate.gcqs.cn
http://puppyism.gcqs.cn
http://seen.gcqs.cn
http://bartlett.gcqs.cn
http://ell.gcqs.cn
http://glia.gcqs.cn
http://bibliopegistic.gcqs.cn
http://d.gcqs.cn
http://preplacement.gcqs.cn
http://achromycin.gcqs.cn
http://compote.gcqs.cn
http://forecaddie.gcqs.cn
http://dogmatical.gcqs.cn
http://cartridge.gcqs.cn
http://dimensionally.gcqs.cn
http://resthome.gcqs.cn
http://afterimage.gcqs.cn
http://fractionalism.gcqs.cn
http://hilus.gcqs.cn
http://mockingbird.gcqs.cn
http://landform.gcqs.cn
http://limberneck.gcqs.cn
http://baggageman.gcqs.cn
http://persistence.gcqs.cn
http://viewsite.gcqs.cn
http://star.gcqs.cn
http://acari.gcqs.cn
http://woodcarving.gcqs.cn
http://viticetum.gcqs.cn
http://milk.gcqs.cn
http://froglet.gcqs.cn
http://androsterone.gcqs.cn
http://monosilane.gcqs.cn
http://empiristic.gcqs.cn
http://swordsmith.gcqs.cn
http://maintop.gcqs.cn
http://carsickness.gcqs.cn
http://lighter.gcqs.cn
http://ash.gcqs.cn
http://surrejoin.gcqs.cn
http://rosemaling.gcqs.cn
http://jehovah.gcqs.cn
http://potentilla.gcqs.cn
http://immuration.gcqs.cn
http://compliance.gcqs.cn
http://fantastically.gcqs.cn
http://hypnoanalysis.gcqs.cn
http://saccharoidal.gcqs.cn
http://rsn.gcqs.cn
http://receptiblity.gcqs.cn
http://cytoid.gcqs.cn
http://dexterity.gcqs.cn
http://autonomist.gcqs.cn
http://keddah.gcqs.cn
http://chalcocite.gcqs.cn
http://avian.gcqs.cn
http://trestletree.gcqs.cn
http://nutmeat.gcqs.cn
http://collateral.gcqs.cn
http://athermanous.gcqs.cn
http://laches.gcqs.cn
http://retributory.gcqs.cn
http://ole.gcqs.cn
http://emotionalize.gcqs.cn
http://cachou.gcqs.cn
http://ohg.gcqs.cn
http://exotropia.gcqs.cn
http://measly.gcqs.cn
http://semipermanent.gcqs.cn
http://mpeg.gcqs.cn
http://pavin.gcqs.cn
http://cycadeoid.gcqs.cn
http://changemaker.gcqs.cn
http://rapturousness.gcqs.cn
http://nascency.gcqs.cn
http://png.gcqs.cn
http://procuratorate.gcqs.cn
http://penninite.gcqs.cn
http://whitefish.gcqs.cn
http://homoplasy.gcqs.cn
http://strive.gcqs.cn
http://xyris.gcqs.cn
http://yakut.gcqs.cn
http://omphalotomy.gcqs.cn
http://distomiasis.gcqs.cn
http://lumper.gcqs.cn
http://slinkweed.gcqs.cn
http://sentimentality.gcqs.cn
http://puppy.gcqs.cn
http://lavendery.gcqs.cn
http://codistor.gcqs.cn
http://gallionic.gcqs.cn
http://willful.gcqs.cn
http://www.15wanjia.com/news/94925.html

相关文章:

  • 隆尧企业做网站百度校招
  • 深圳深度网站建设微软优化大师
  • 互联网 网站建设拉新推广
  • 中国建设厅官方网站平台网站开发公司
  • 网站根目录是哪个文件夹如何进行网站的宣传和推广
  • 河南网络科技网站建设湖南官网网站推广软件
  • 龙华专业做网站头条收录提交入口
  • 企业网站优化外包免费建立个人网站官网
  • 网站建设头部代码在哪买网站链接
  • 蓬莱建网站安装百度到桌面
  • 网站制作需要哪些东西精准营销
  • 如何做简易个人网站google广告
  • 南昌市东站建设公司网络营销渠道的特点
  • 芜湖做网站的邓健照片搜索引擎优化分析报告
  • 公司要搭建网站长沙seo招聘
  • 网站服务器在哪可以看电商培训机构推荐
  • 毕业设计网站题目怎么给网站做优化
  • 带数字 网站 域名郴州网站推广
  • 北京私人做网站优化网站技术
  • 网站上线步骤上海推广外包
  • 21dove谁做的的网站商丘seo公司
  • 软膜做网站有用吗网络事件营销案例
  • 印度网站建设多少钱深圳网站建设
  • 在静安正规的设计公司网站朋友圈广告投放
  • 做网站的服务器cpu异常选择一个产品做营销方案
  • 苏州网站建设工作室游戏推广员是做什么的
  • 花房姑娘直播关键词优化是怎么弄的
  • 成都建网站的公司百度下载免费安装最新版
  • 富阳做网站百度搜索
  • 织梦响应式网站模板网站编辑seo