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

湖北中牛建设有限公司网站建立网站准备工作流程

湖北中牛建设有限公司网站,建立网站准备工作流程,wordpress首页打不开内容页正常,穆棱建设局网站原理 跳表#xff08;Skip List#xff09; 是一种随机化数据结构#xff0c;用于高效查找、插入和删除#xff0c;尤其适用于有序数据集合。相比链表#xff0c;跳表通过多层索引结构加速查找#xff0c;期望时间复杂度接近 O(log⁡n)。跳表的主要思想是#xff1a; …原理 跳表Skip List 是一种随机化数据结构用于高效查找、插入和删除尤其适用于有序数据集合。相比链表跳表通过多层索引结构加速查找期望时间复杂度接近 O(log⁡n)。跳表的主要思想是 底层链表存储所有数据元素保持有序。上层链表是稀疏索引用于跳过部分节点减少遍历的长度。 结构图 下面是一个跳表的结构示意 Level 3: [1] ---------------- [9] Level 2: [1] ----- [4] ----- [9] Level 1: [1] ----- [4] ----- [7] ----- [9] Level 0: [1] - [2] - [4] - [5] - [7] - [8] - [9]如上图所示 每一层都是一个有序链表。每一层的节点是下一层的子集存储重要的中间节点形成分层索引。查找过程从最高层开始先向右移动如果目标值超出范围则向下移动到下一层。重复此过程直到找到目标节点。 优缺点 优点 插入、删除和查找的期望时间复杂度为 O(log⁡n)。实现简单比红黑树和AVL树更容易理解和维护。 缺点 需要额外的空间存储索引层节点。 代码示例c 下面是一段简单的 C 跳表实现包括节点结构定义、插入、查找和显示功能。 #include iostream #include cstdlib #include ctime #include vector using namespace std;class Node { public:int value;vectorNode* forward; // 每层的前向指针Node(int val, int level) : value(val), forward(level 1, nullptr) {} };class SkipList { private:int maxLevel; // 跳表的最大层数float probability; // 晋升概率Node* header; // 头节点int currentLevel; // 当前跳表的层数public:SkipList(int maxLevel, float probability) : maxLevel(maxLevel), probability(probability), currentLevel(0) {header new Node(-1, maxLevel); // 头节点初始化为-1srand(time(nullptr)); // 初始化随机数种子}// 随机生成节点的层数int randomLevel() {int lvl 0;while ((rand() / double(RAND_MAX)) probability lvl maxLevel) {lvl;}return lvl;}// 插入新节点void insert(int value) {vectorNode* update(maxLevel 1);Node* current header;// 从最高层向下查找插入位置for (int i currentLevel; i 0; i--) {while (current-forward[i] current-forward[i]-value value) {current current-forward[i];}update[i] current;}// 在底层插入节点的位置current current-forward[0];// 如果节点不存在则插入新节点if (!current || current-value ! value) {int lvl randomLevel();if (lvl currentLevel) {for (int i currentLevel 1; i lvl; i) {update[i] header;}currentLevel lvl;}Node* newNode new Node(value, lvl);for (int i 0; i lvl; i) {newNode-forward[i] update[i]-forward[i];update[i]-forward[i] newNode;}cout Inserted value: value at level: lvl endl;}}// 查找节点bool search(int value) {Node* current header;for (int i currentLevel; i 0; i--) {while (current-forward[i] current-forward[i]-value value) {current current-forward[i];}}current current-forward[0];return current current-value value;}// 打印跳表结构void display() {for (int i currentLevel; i 0; i--) {Node* current header-forward[i];cout Level i : ;while (current) {cout current-value ;current current-forward[i];}cout endl;}} };int main() {SkipList skipList(4, 0.5); // 最大层数为4晋升概率为0.5skipList.insert(3);skipList.insert(6);skipList.insert(7);skipList.insert(9);skipList.insert(12);skipList.insert(19);cout Skip List Structure: endl;skipList.display();cout Search 7: (skipList.search(7) ? Found : Not Found) endl;cout Search 4: (skipList.search(4) ? Found : Not Found) endl;return 0; }代码解析 Node 类 表示跳表中的节点包含节点的值和指向不同层节点的指针向量 forward。 SkipList 类 实现了跳表的主要功能包括插入、查找和显示结构。randomLevel用于随机生成节点的层数控制索引的稀疏程度。insert插入元素到跳表中如果新节点的层数超过当前最大层数则更新索引。search查找目标值是否存在。 主函数 初始化跳表并插入若干元素测试插入和查找功能。 运行结果 Inserted value: 3 at level: 0 Inserted value: 6 at level: 1 Inserted value: 7 at level: 2 Inserted value: 9 at level: 0 Inserted value: 12 at level: 1 Inserted value: 19 at level: 3 Skip List Structure: Level 3: 19 Level 2: 7 19 Level 1: 6 12 19 Level 0: 3 6 7 9 12 19 Search 7: Found Search 4: Not Found总结 时间复杂度查找、插入、删除的期望时间复杂度为 O(log⁡n)O(\log n)O(logn)。空间复杂度O(nlog⁡n)O(n \log n)O(nlogn)因为每个节点可能会出现在多层中。 跳表的实现简单且高效常用于 Redis 等数据库的有序集合。
文章转载自:
http://www.morning.aowuu.com.gov.cn.aowuu.com
http://www.morning.cwpny.cn.gov.cn.cwpny.cn
http://www.morning.c7495.cn.gov.cn.c7495.cn
http://www.morning.brqjs.cn.gov.cn.brqjs.cn
http://www.morning.jokesm.com.gov.cn.jokesm.com
http://www.morning.ppbqz.cn.gov.cn.ppbqz.cn
http://www.morning.gwwtm.cn.gov.cn.gwwtm.cn
http://www.morning.jppdk.cn.gov.cn.jppdk.cn
http://www.morning.plzgt.cn.gov.cn.plzgt.cn
http://www.morning.mwnch.cn.gov.cn.mwnch.cn
http://www.morning.nbfkk.cn.gov.cn.nbfkk.cn
http://www.morning.lphtm.cn.gov.cn.lphtm.cn
http://www.morning.zztmk.cn.gov.cn.zztmk.cn
http://www.morning.ccyjt.cn.gov.cn.ccyjt.cn
http://www.morning.snygg.cn.gov.cn.snygg.cn
http://www.morning.gqwpl.cn.gov.cn.gqwpl.cn
http://www.morning.yszrk.cn.gov.cn.yszrk.cn
http://www.morning.dxqfh.cn.gov.cn.dxqfh.cn
http://www.morning.gwjqq.cn.gov.cn.gwjqq.cn
http://www.morning.mtrz.cn.gov.cn.mtrz.cn
http://www.morning.pbmkh.cn.gov.cn.pbmkh.cn
http://www.morning.rywn.cn.gov.cn.rywn.cn
http://www.morning.51meihou.cn.gov.cn.51meihou.cn
http://www.morning.jyfrz.cn.gov.cn.jyfrz.cn
http://www.morning.zpzys.cn.gov.cn.zpzys.cn
http://www.morning.gjzwj.cn.gov.cn.gjzwj.cn
http://www.morning.fydsr.cn.gov.cn.fydsr.cn
http://www.morning.mlwhd.cn.gov.cn.mlwhd.cn
http://www.morning.jsrnf.cn.gov.cn.jsrnf.cn
http://www.morning.ydwsg.cn.gov.cn.ydwsg.cn
http://www.morning.yrrnx.cn.gov.cn.yrrnx.cn
http://www.morning.brfxt.cn.gov.cn.brfxt.cn
http://www.morning.jrqbr.cn.gov.cn.jrqbr.cn
http://www.morning.pmdzd.cn.gov.cn.pmdzd.cn
http://www.morning.lrnfn.cn.gov.cn.lrnfn.cn
http://www.morning.nlrp.cn.gov.cn.nlrp.cn
http://www.morning.ybhrb.cn.gov.cn.ybhrb.cn
http://www.morning.xwbld.cn.gov.cn.xwbld.cn
http://www.morning.zxzgr.cn.gov.cn.zxzgr.cn
http://www.morning.gcspr.cn.gov.cn.gcspr.cn
http://www.morning.tfgkq.cn.gov.cn.tfgkq.cn
http://www.morning.saastob.com.gov.cn.saastob.com
http://www.morning.qwpdl.cn.gov.cn.qwpdl.cn
http://www.morning.klzt.cn.gov.cn.klzt.cn
http://www.morning.nzwp.cn.gov.cn.nzwp.cn
http://www.morning.nlhcb.cn.gov.cn.nlhcb.cn
http://www.morning.kcdts.cn.gov.cn.kcdts.cn
http://www.morning.nrll.cn.gov.cn.nrll.cn
http://www.morning.tbjtp.cn.gov.cn.tbjtp.cn
http://www.morning.qmpbs.cn.gov.cn.qmpbs.cn
http://www.morning.smxyw.cn.gov.cn.smxyw.cn
http://www.morning.hnrdtz.com.gov.cn.hnrdtz.com
http://www.morning.rbhqz.cn.gov.cn.rbhqz.cn
http://www.morning.lnckq.cn.gov.cn.lnckq.cn
http://www.morning.rwjfs.cn.gov.cn.rwjfs.cn
http://www.morning.krfpj.cn.gov.cn.krfpj.cn
http://www.morning.mfnjk.cn.gov.cn.mfnjk.cn
http://www.morning.szoptic.com.gov.cn.szoptic.com
http://www.morning.fkcjs.cn.gov.cn.fkcjs.cn
http://www.morning.qieistand.com.gov.cn.qieistand.com
http://www.morning.gygfx.cn.gov.cn.gygfx.cn
http://www.morning.smspc.cn.gov.cn.smspc.cn
http://www.morning.ychrn.cn.gov.cn.ychrn.cn
http://www.morning.qpqwb.cn.gov.cn.qpqwb.cn
http://www.morning.mumgou.com.gov.cn.mumgou.com
http://www.morning.pgjyc.cn.gov.cn.pgjyc.cn
http://www.morning.nqpy.cn.gov.cn.nqpy.cn
http://www.morning.wjrq.cn.gov.cn.wjrq.cn
http://www.morning.cjmmt.cn.gov.cn.cjmmt.cn
http://www.morning.xyjlh.cn.gov.cn.xyjlh.cn
http://www.morning.hzqjgas.com.gov.cn.hzqjgas.com
http://www.morning.cyysq.cn.gov.cn.cyysq.cn
http://www.morning.gychx.cn.gov.cn.gychx.cn
http://www.morning.bfrsr.cn.gov.cn.bfrsr.cn
http://www.morning.ldwxj.cn.gov.cn.ldwxj.cn
http://www.morning.xlxmy.cn.gov.cn.xlxmy.cn
http://www.morning.npkrm.cn.gov.cn.npkrm.cn
http://www.morning.mflqd.cn.gov.cn.mflqd.cn
http://www.morning.lkkgq.cn.gov.cn.lkkgq.cn
http://www.morning.rpkg.cn.gov.cn.rpkg.cn
http://www.tj-hxxt.cn/news/255104.html

相关文章:

  • django做网站比较容易wordpress建站网页无法运作
  • 外贸网站建站系统网站建设公司的市场营销方案
  • 免费申请手机网站大连微信网站制作
  • 阻止网站查到访问者ip中交通力建设股份有限公司网站
  • 沈阳个人网站制作杭州网站建设设计
  • 西数网站助手免费网站商城建设
  • 网站集约化建设的总体情况公司网站续费
  • html5建站系统公司网站更新
  • 网站建设与推广的区别wordpress 协同
  • 做网站需要学哪些语言上海网站开发方案
  • 手机网站 百度推广wordpress模板在哪个目录
  • 如何查询网站的点击量沈阳今天最新通知
  • 公司网站开发设计网站建设与管理 教学大纲
  • 短视频直播运营版源码下载搜索引擎优化包括
  • 天猫店铺装修做特效的网站wordpress会员数据共同
  • 濮阳家电网站建设沈阳网站制作公司
  • 甘肃省建设厅注册中心网站网站怎么接广告赚钱
  • 指示灯具网站建设做花型设计哪个网站下载素材好
  • 网站建设理论零基础学软件开发难吗
  • 做网站的公司为什么人少了500个企点qq大概多少钱
  • 17做网站官网湖南企业网络推广服务
  • 如何做adsense网站网络购物商城网站建设
  • 推广农村特色产品建设网站方案快速搭建网站信息库
  • 东莞网站制作建设阿里巴巴网站被关闭了要怎么做
  • 聊城市建设局网站首页阿里云主机可以放几个网站
  • 哪里建设网站不会被封简易网站制作软件
  • 重庆建站服务商网站seo插件
  • 课程网站建设的目标最新新闻热点事件ppt
  • 怎么做短文网站邓州网络推广有效的方法
  • asp网站如何搭建网站建设基本流程ppt