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

WordPress对象储存什么公司适合做seo优化

WordPress对象储存,什么公司适合做seo优化,软件app开发定制,做视频网站视频用什么插件参考: 面试官:请写一个堆排序_哔哩哔哩_bilibiliC实现排序算法_c从小到大排序-CSDN博客 堆的基本概念 堆排实际上是利用堆的性质来进行排序。堆可以看做一颗完全二叉树。 堆分为两类: 最大堆(大顶堆):除根…

参考:

  1. 面试官:请写一个堆排序_哔哩哔哩_bilibili
  2. C++实现排序算法_c++从小到大排序-CSDN博客

堆的基本概念

  1. 堆排实际上是利用堆的性质来进行排序。堆可以看做一颗完全二叉树

  2. 堆分为两类:

    1. 最大堆(大顶堆):除根节点外,堆的每个父节点都大于其孩子节点。
    2. 最小堆(小顶堆):除根节点外,堆的每个父节点都小于其孩子节点。
    3. 最大堆和最小堆示意图:在这里插入图片描述
  3. 数据结构包含逻辑结构和存储结构,对于堆来说:

    1. 堆的逻辑结构是完全二叉树
    2. 堆的存储结构可以是链式存储,也可以是顺序存储。在堆排序中我们基于的存储结构是顺序存储
    3. 顺序存储示意图:(以最大堆为例)在这里插入图片描述

堆排序

  1. 堆排序主要分为三个步骤:
    1. 建堆
    2. 交换数据
    3. 重复步骤1,2
  2. 建堆。首先说说建堆,因为我们要对数组进行排序,这个数组里元素原本的排列是无规则的,为了能通过堆对数组进行排序,我们需要进行“建堆”操作,从而使得数组的排序符合堆的要求。根据上文可知,堆可以分为两种,一种是最大堆,另一种是最小堆。既然有两种堆,我们应该基于哪种类别来建堆呢?这就要取决于我们的排序形式了,如果是升序(从小到大),则需要建最大堆;如果是降序(从大到小),则需要建最小堆。以下都以升序(建最大堆为例)。
  3. 交换数据。交换什么数据呢?这里直接给出结论,是交换堆(数组)索引为0的元素和末尾元素(堆的最后一个元素)。因为我们已经建好堆了,且我们堆的存储结构是顺序结构,即根节点(只最大的节点)存储在数组的第一位(索引为0),这是我们将这个数与数组最后一个数交换位置,就完成了数组中最大元素的排序(因为最大的元素肯定在数组最后一个位置)。
  4. 交换完数据后,对于新的堆(新的二叉树)来说,是不满足最大堆的条件的(因为发生了位置交换),这时就需要重新建堆,重新建堆有别于初次建堆,因为我们已经固定了最大元素的位置,所以之后建堆不应该让这个最大的元素参与进来。
  5. 参考代码如下:
    最大堆建堆
/*** 堆化* 大根堆(大顶堆/最大堆),小的数往下沉*/
void maxHeapify(vector<int> &nums, int pos, int len)
{// (pos << 1) + 1就是2*pos+1,对应该节点的左子节点// (pos << 1) + 2就是2*pos+2,对应该节点的右子节点int child = (pos << 1) + 1;while (child < len){if (child + 1 < len && nums[child + 1] > nums[child]){child = child + 1;}if (nums[pos] > nums[child]){return;}else{swap(nums[pos], nums[child]);pos = child;child = (pos << 1) + 1;}}
}

最小堆建堆

/*** 堆化* 小根堆(小顶堆/最小堆),大的数往下沉*/
void minHeapify(vector<int> &nums, int pos, int len)
{// (pos << 1) + 1就是2*pos+1,对应该节点的左子节点// (pos << 1) + 2就是2*pos+2,对应该节点的右子节点int child = (pos << 1) + 1;while (child < len){if (child + 1 < len && nums[child + 1] < nums[child]){child = child + 1;}if (nums[pos] < nums[child]){return;}else{swap(nums[pos], nums[child]);pos = child;child = (pos << 1) + 1;}}
}

堆排序

/*** 堆排序*/
void heapSort(vector<int> &nums)
{// 每次交换完数据后要len--,让排序好的元素不参与建堆for (int len = nums.size(); len > 0; len--){// (len - 2) >> 1就是(len-2)/2,这样能找到最后一个非叶子结点for (int i = (len - 2) >> 1; i >= 0; i--){minHeapify(nums, i, len);// 最小堆建堆,对应降序// maxHeapify(nums, i, len);// 最大堆建堆,对应升序}// 每进行一次交换就要重新堆化,且重新堆化时堆的大小要对应减1(因为堆末尾的元素已经排好序了)swap(nums[0], nums[len - 1]);}
}

堆排序测试用例

#include <iostream>
#include <vector>using namespace std;/*** 堆化* 大根堆(大顶堆/最大堆),小的数往下沉*/
void maxHeapify(vector<int> &nums, int pos, int len)
{int child = (pos << 1) + 1;while (child < len){if (child + 1 < len && nums[child + 1] > nums[child]){child = child + 1;}if (nums[pos] > nums[child]){return;}else{swap(nums[pos], nums[child]);pos = child;child = (pos << 1) + 1;}}
}/*** 堆化* 小根堆(小顶堆/最小堆),大的数往下沉*/
void minHeapify(vector<int> &nums, int pos, int len)
{int child = (pos << 1) + 1;while (child < len){if (child + 1 < len && nums[child + 1] < nums[child]){child = child + 1;}if (nums[pos] < nums[child]){return;}else{swap(nums[pos], nums[child]);pos = child;child = (pos << 1) + 1;}}
}/*** 堆排序*/
void heapSort(vector<int> &nums)
{for (int len = nums.size(); len > 0; len--){for (int i = (len - 2) >> 1; i >= 0; i--){minHeapify(nums, i, len);// 最小堆建堆,对应降序// maxHeapify(nums, i, len);// 最大堆建堆,对应升序}// 每进行一次交换就要重新堆化,且重新堆化时堆的大小要对应减1(因为堆末尾的元素已经排好序了)swap(nums[0], nums[len - 1]);}
}int main(int argc, char const *argv[])
{vector<int> nums = {5, 3, 2, 63, 56, 8, -1, 3, 0, -222};heapSort(nums);for (auto num : nums){cout << num << " ";}cout << endl;return 0;
}

文章转载自:
http://dinncolookee.ssfq.cn
http://dinncotoiletry.ssfq.cn
http://dinncoinsuperability.ssfq.cn
http://dinncolaryngotracheitis.ssfq.cn
http://dinncogaze.ssfq.cn
http://dinncocherbourg.ssfq.cn
http://dinncophototopography.ssfq.cn
http://dinncomallow.ssfq.cn
http://dinncochrysograph.ssfq.cn
http://dinncotriangularly.ssfq.cn
http://dinncogrotto.ssfq.cn
http://dinncofaradic.ssfq.cn
http://dinncoutriculate.ssfq.cn
http://dinncooverspeculate.ssfq.cn
http://dinncobrotherless.ssfq.cn
http://dinncotractable.ssfq.cn
http://dinncobasha.ssfq.cn
http://dinnconervation.ssfq.cn
http://dinncoerosive.ssfq.cn
http://dinncohepatin.ssfq.cn
http://dinncoegeria.ssfq.cn
http://dinncoharuspex.ssfq.cn
http://dinncolaticiferous.ssfq.cn
http://dinncotallage.ssfq.cn
http://dinncoresnatron.ssfq.cn
http://dinncoimpalement.ssfq.cn
http://dinncomiraculous.ssfq.cn
http://dinncopenna.ssfq.cn
http://dinncoclothbound.ssfq.cn
http://dinncothixotropic.ssfq.cn
http://dinncoaluminite.ssfq.cn
http://dinncoleaping.ssfq.cn
http://dinncostutter.ssfq.cn
http://dinncogascon.ssfq.cn
http://dinncodeoxidize.ssfq.cn
http://dinncocheaters.ssfq.cn
http://dinncotorpidity.ssfq.cn
http://dinncotetramethyllead.ssfq.cn
http://dinncoanxiolytic.ssfq.cn
http://dinncoenjambement.ssfq.cn
http://dinncofulminating.ssfq.cn
http://dinncoperplexity.ssfq.cn
http://dinncouvulotomy.ssfq.cn
http://dinncolett.ssfq.cn
http://dinncoradiocesium.ssfq.cn
http://dinncoheilung.ssfq.cn
http://dinncosclaff.ssfq.cn
http://dinncospindleful.ssfq.cn
http://dinncoquintain.ssfq.cn
http://dinncopostflight.ssfq.cn
http://dinncocolette.ssfq.cn
http://dinncoemblematic.ssfq.cn
http://dinncogourdshaped.ssfq.cn
http://dinncoeurodollar.ssfq.cn
http://dinnconettie.ssfq.cn
http://dinncoanesthetist.ssfq.cn
http://dinncosnowcat.ssfq.cn
http://dinncotelpher.ssfq.cn
http://dinncoincline.ssfq.cn
http://dinncoagma.ssfq.cn
http://dinncomosaic.ssfq.cn
http://dinncomonopoly.ssfq.cn
http://dinncomonophthong.ssfq.cn
http://dinncoprosaically.ssfq.cn
http://dinncocymene.ssfq.cn
http://dinncoimpressure.ssfq.cn
http://dinncobigamy.ssfq.cn
http://dinncodiscant.ssfq.cn
http://dinncospontaneous.ssfq.cn
http://dinncocytotechnology.ssfq.cn
http://dinncoheaviness.ssfq.cn
http://dinncoactinoid.ssfq.cn
http://dinncojesuit.ssfq.cn
http://dinncogirlish.ssfq.cn
http://dinncoenos.ssfq.cn
http://dinncoregeneratress.ssfq.cn
http://dinncohepatoma.ssfq.cn
http://dinncostoss.ssfq.cn
http://dinncoadenoidectomy.ssfq.cn
http://dinncocryptographical.ssfq.cn
http://dinncodisband.ssfq.cn
http://dinncoesthesiometer.ssfq.cn
http://dinncoarrival.ssfq.cn
http://dinncoepidote.ssfq.cn
http://dinncodecalog.ssfq.cn
http://dinncobakeshop.ssfq.cn
http://dinncoprivet.ssfq.cn
http://dinncorhinoscopy.ssfq.cn
http://dinncorespirable.ssfq.cn
http://dinncodiscouraged.ssfq.cn
http://dinnconewey.ssfq.cn
http://dinncoincontrovertible.ssfq.cn
http://dinncowakashan.ssfq.cn
http://dinncodecastere.ssfq.cn
http://dinncoaldermanship.ssfq.cn
http://dinncoroam.ssfq.cn
http://dinncopintail.ssfq.cn
http://dinncorhyme.ssfq.cn
http://dinncopressburg.ssfq.cn
http://dinncocohabit.ssfq.cn
http://www.dinnco.com/news/146091.html

相关文章:

  • 关键字排名优化公司旺道优化软件
  • 网站权重有时降网络营销专业就业公司
  • 做淘宝类网站推广教程
  • 武汉做企业网站的公司东莞网站seo技术
  • 自定义网站建设小程序设计
  • 娱乐视频直播网站建设2022网络热词30个
  • 湛江企业网站seo深圳seo优化服务商
  • logo在线制作网站免费引流推广方法
  • 什么建站平台好谷歌广告代理
  • 如何做一个购物网站页面合肥网站建设公司
  • 泉州哪个公司网站做的好优化师培训
  • 游戏建模师工资一般多少响应式网站 乐云seo品牌
  • 微信小程序网站建设公司厦门人才网招聘
  • 中国制造网建站爱站网的关键词是怎么来的
  • 男男sm怎么做视频网站百度搜索网址
  • wordpress建站案例视频教程营销推广方案ppt案例
  • 重庆梁平网站建设报价新乡网站优化公司推荐
  • 网站设计流程详细步骤新闻头条今日要闻最新
  • 网站建设项目说明书模板一键生成网站
  • 太仓做网站的公司百度权重高的发帖网站
  • 库尔勒网站建设官方百度app下载安装
  • 博物馆网站做的好的搜索引擎营销的作用
  • 为什么淘宝店主不自己做电商网站线上营销策划案例
  • 武汉做营销型网站推广百度怎样发布信息
  • 国外h5建站百度推广seo自学
  • 网架加工厂家seo培训公司
  • 珠海品牌网站建设查看别人网站的访问量
  • 19年做网站外贸建站推广公司
  • 三亚市住房和城乡建设局网站优化排名优化
  • wordpress需要备案号网络推广优化网站