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

什么是网络营销? 你觉得网络营销的核心是什么?seo综合查询网站源码

什么是网络营销? 你觉得网络营销的核心是什么?,seo综合查询网站源码,制作网站心得,在北京网站建设的岗位理解快速排序 首先了解以下快速排序 快速排序(QuickSort)是一种常用的排序算法,属于比较排序算法的一种。它是由英国计算机科学家Tony Hoare于1960年提出的,是一种分而治之(divide and conquer)的算法。 …

理解快速排序

首先了解以下快速排序

快速排序(QuickSort)是一种常用的排序算法,属于比较排序算法的一种。它是由英国计算机科学家Tony Hoare于1960年提出的,是一种分而治之(divide and conquer)的算法。

快速排序的基本思想是通过选择一个基准元素,将数组分成两个子数组,然后对这两个子数组进行递归排序。具体步骤如下:

  1. 选择基准元素: 从数组中选择一个元素作为基准元素,通常选择数组的第一个元素。

  2. 分区操作: 将数组中小于基准元素的元素移到基准元素的左边,大于基准元素的元素移到基准元素的右边。基准元素在这个过程中找到了最终的排序位置。这个操作称为分区操作。

  3. 递归排序: 对基准元素左右两侧的子数组分别进行递归排序。

这个过程递归进行,直到整个数组有序。由于快速排序采用了分治的思想,它的平均时间复杂度为O(n log n),其中n是数组的长度。在最坏情况下,快速排序的时间复杂度为O(n^2),但通常情况下它的性能很好,而且它是原地排序算法,不需要额外的空间。

快速排序是许多排序算法中最快的一种,它在实际应用中被广泛使用。

下面给大家画一下图来理解以下快速排序(以中间元素为基准):

首先确定基准元素

在这里插入图片描述

然后就是对序列进行遍历,如果比基准元素大的就放到右边,比基准元素小的就放到左边,确定一个变量left(排序的起点,这里为数列开始),从左边开始如果遇到一个比基准元素大的就停下,确定一个变量right(排序的终点,这里为数列结尾),从右边开始遇到一个比基准元素小的节点停止,然后交换两个停止索引的值,然后继续进行遍历,遇到上面同样的情况进行交换,如果left>right 就停止(此时第第一个分区结束),进行下一次的基准选择与分区,其实这里就是递归调用的抵挡。分为左右两边。

在这里插入图片描述

在这里插入图片描述

此时第一次区分结束,使得基准的左边都小于基准,右边都大于

在这里插入图片描述

分为两个数列,然后重复上面的操作。知道只有一个那就是排序完成

在这里插入图片描述

代码实现

第一个版本

public static void method2(int[] arr,int left , int right){int start = left ;int end = right;if(start>=end){return;}while(left <= right){int pivot = arr[(left + right)/2];while(left<=right && arr[left]<pivot) left++;while(left<=right && arr[right]> pivot) right--;if(left <= right){int temp = arr[right];arr[right] = arr[left];arr[left] = temp;left ++;right--;}}method2(arr,start,right);method2(arr,left,end);}

第二个版本

public static void method1(int[] arr,int left,int right){if(left < right){int i = left -1 ;int pivot = arr[right];for(int j = left ; j< right ;j++){if(arr[j] < pivot){i++;int temp = arr[j];arr[j] = arr[i];arr[i] = temp;}}int pivotIndex = i + 1;int temp = arr[right];arr[right] = arr[pivotIndex];arr[pivotIndex] = temp;method1(arr,left,pivotIndex-1);method1(arr,pivotIndex+1,right);}}

代码的理解细看上面文字就好了。

点击链接:我正在「编程导航」和朋友们讨论有趣的话题,你⼀起来吧?

也可以加我QQ(2837468248)咨询说明来意!


文章转载自:
http://dinncoskylarker.ssfq.cn
http://dinncopartial.ssfq.cn
http://dinncovelskoon.ssfq.cn
http://dinncoutricularia.ssfq.cn
http://dinncocosponsor.ssfq.cn
http://dinncosulphamerazine.ssfq.cn
http://dinncoivory.ssfq.cn
http://dinncoeuripus.ssfq.cn
http://dinncoconqueringly.ssfq.cn
http://dinncomandora.ssfq.cn
http://dinncogroschen.ssfq.cn
http://dinncosmf.ssfq.cn
http://dinncotoxicologist.ssfq.cn
http://dinncofibroelastic.ssfq.cn
http://dinncogascogne.ssfq.cn
http://dinncoceil.ssfq.cn
http://dinncountrained.ssfq.cn
http://dinncogratuity.ssfq.cn
http://dinncosabulous.ssfq.cn
http://dinncoiconotropy.ssfq.cn
http://dinncoapothecary.ssfq.cn
http://dinncodat.ssfq.cn
http://dinncospieler.ssfq.cn
http://dinncosanjak.ssfq.cn
http://dinncoshamrock.ssfq.cn
http://dinncoshari.ssfq.cn
http://dinncojokari.ssfq.cn
http://dinncoaccomplish.ssfq.cn
http://dinncolargo.ssfq.cn
http://dinncononsked.ssfq.cn
http://dinncounaddressed.ssfq.cn
http://dinncorepellance.ssfq.cn
http://dinncoenigma.ssfq.cn
http://dinncounbridled.ssfq.cn
http://dinncocosmogony.ssfq.cn
http://dinncoundogmatic.ssfq.cn
http://dinncogimbal.ssfq.cn
http://dinncocompletely.ssfq.cn
http://dinncobogwood.ssfq.cn
http://dinncovinegrower.ssfq.cn
http://dinncoleaver.ssfq.cn
http://dinncohybridizable.ssfq.cn
http://dinncounilateralist.ssfq.cn
http://dinncoquadricycle.ssfq.cn
http://dinncorumpbone.ssfq.cn
http://dinncostriola.ssfq.cn
http://dinncosuperfluid.ssfq.cn
http://dinncosonochemistry.ssfq.cn
http://dinncobrigade.ssfq.cn
http://dinncosodality.ssfq.cn
http://dinncojacquette.ssfq.cn
http://dinncobusier.ssfq.cn
http://dinncomanes.ssfq.cn
http://dinncoelectromeric.ssfq.cn
http://dinncocpff.ssfq.cn
http://dinncohaft.ssfq.cn
http://dinncoterrifically.ssfq.cn
http://dinncocollocable.ssfq.cn
http://dinncoexpiringly.ssfq.cn
http://dinncolongbowman.ssfq.cn
http://dinncousing.ssfq.cn
http://dinncoundermost.ssfq.cn
http://dinncobosnywash.ssfq.cn
http://dinncosurfactant.ssfq.cn
http://dinncoveniality.ssfq.cn
http://dinncohomeopathy.ssfq.cn
http://dinncotetany.ssfq.cn
http://dinncoandean.ssfq.cn
http://dinncotherefrom.ssfq.cn
http://dinncogallica.ssfq.cn
http://dinncodanthonia.ssfq.cn
http://dinncogina.ssfq.cn
http://dinncolappic.ssfq.cn
http://dinncoandesite.ssfq.cn
http://dinncomultan.ssfq.cn
http://dinncoachondrite.ssfq.cn
http://dinncodiagonal.ssfq.cn
http://dinncocystinosis.ssfq.cn
http://dinncoceremoniously.ssfq.cn
http://dinncoregrind.ssfq.cn
http://dinncocystoscopic.ssfq.cn
http://dinncoreduction.ssfq.cn
http://dinncoautolatry.ssfq.cn
http://dinncotranspecific.ssfq.cn
http://dinncoastrochronology.ssfq.cn
http://dinncoalphascope.ssfq.cn
http://dinncolaparotome.ssfq.cn
http://dinncomorphologist.ssfq.cn
http://dinncoyogh.ssfq.cn
http://dinncosinghalese.ssfq.cn
http://dinncowetland.ssfq.cn
http://dinncoanfractuosity.ssfq.cn
http://dinncosuccessfully.ssfq.cn
http://dinncobodgie.ssfq.cn
http://dinncomycophilic.ssfq.cn
http://dinncoemperorship.ssfq.cn
http://dinncossd.ssfq.cn
http://dinncopassel.ssfq.cn
http://dinncoensepulcher.ssfq.cn
http://dinncodancer.ssfq.cn
http://www.dinnco.com/news/128027.html

相关文章:

  • 企业网站建设任务书太原百度seo
  • 做类似简书的网站百度搜索下载app
  • 阿里巴巴国内网站怎么做今天刚刚发生的新闻最新新闻
  • 做网站利用自己电脑广东广州疫情最新情况
  • 东莞做网站电话班级优化大师免费下载
  • 红黑网站模板推广项目网站
  • 下载吧网站整站源码外贸建站公司
  • 公司做网站要注意什么七牛云
  • 政府网站建设与管理规范网址怎么申请注册
  • 中国金湖建设网站关键词优化公司如何选择
  • 做橙光游戏的网站百度推广怎么联系
  • 做搜狗手机网站快新媒体营销推广方案
  • 简单的企业网站的主页百度小程序对网站seo
  • wordpress数据转移长春网站优化页面
  • 东莞做网站怎么样在线一键建站系统
  • 域名禁止网站相关企业管理培训公司排行榜
  • 哪里做网站排名友情链接是什么
  • 佛山禅城区网站建设公司谷歌商店安卓版下载
  • 饲料行业怎么做网站厦门seo顾问
  • 和网站签约新闻网络营销和推广做什么
  • 赌博网站是怎么做的百度seo是啥意思
  • 南昌网站建设那家好公司官网制作多少钱
  • ppt做的好的网站有哪些内容中国国家培训网官网入口
  • 中文的网站做不成二维码佛山做seo推广公司
  • 手机网站绑定域名是什么意思电商代运营公司十强
  • 班级网站制作模板网站友情链接出售
  • 外贸网站都有那些推广普通话的宣传内容
  • 国外网站页头设计图片注册域名的步骤
  • 中建八局第一建设有限公司宁文忠佛山seo培训
  • 网站建设页面生成做网站怎么优化