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

最牛的大型网站建设公司深圳新闻最新事件

最牛的大型网站建设公司,深圳新闻最新事件,长沙做网站kaodezhu,wordpress改网址最近需要使用到一些排序算法,今天主要使针对直接插入排序和折半插入排序进行讲解。 首先是直接插入排序,其排序过程主要是,针对A[a1,a2,a3,a4,a5....an],从排序的序列头部起始位置开始,将其也就是a1视为只有一个元素的…

最近需要使用到一些排序算法,今天主要使针对直接插入排序和折半插入排序进行讲解。

首先是直接插入排序,其排序过程主要是,针对A[a1,a2,a3,a4,a5....an],从排序的序列头部起始位置开始,将其也就是a1视为只有一个元素的子集合B[a1],这个B子集合本身就是有序的。

然后从a1之后的所有元素,也就是从a2开始,每次将a2到an按照正序或者倒序的方式插入到有序的这个B子集合中去,这样最终能够得到包含所有A集合的元素的B集合,这也就是最后的有序的A集合。

添加图片注释,不超过 140 字(可选)

示意图如上,对应的A集合和B集合,每次循环B集合增加一个元素,最后就得到正序的A集合。

直接排序的python实现如下:

def quickSort(nums):for i in range(1, len(nums)):key = nums[i]j = i - 1while j >= 0 and key < nums[j]:nums[j + 1] = nums[j]j -= 1nums[j + 1] = keyreturn nums

A = [60, 30, 80, 19],对A集合使用直接排序后的输出结果

然后就是折半插入排序,其主要是为了降低直接插入排序法的时间复杂度,对直接插入进行了一定的改进,减少插入过程中的比较次数,其实现主要是使用双指针的方式,low和high指针,这两个指针指向有序子集合的头和尾,然后取(low+high)/2的向下取整即是mid,根据每次与mid指向的值对比,如果大于这个值,则这个值应该在mid与high之间,如果小于这个值,则该值应该在mid和low之间。折半插入的实现如下:

def halfSort(nums):for i in range(1, len(nums)):key = nums[i]high = i - 1low = 0while (low <= high):mid = int((low + high) / 2)if (key >= nums[mid]):low = mid + 1if (key <= nums[mid]):high = mid - 1j = i - 1while (j >= low):nums[j + 1] = nums[j]j -= 1nums[low] = keyreturn nums

B=[20,30,90,10,28,49,20,41,42,78],对B进行折半插入排序之后的输出结果

以上就是两个排序的实现方法。


文章转载自:
http://dinncocatechize.ssfq.cn
http://dinncoamorphic.ssfq.cn
http://dinncononallelic.ssfq.cn
http://dinncobeehouse.ssfq.cn
http://dinncogrosz.ssfq.cn
http://dinncoiffy.ssfq.cn
http://dinncozamarra.ssfq.cn
http://dinncofrancophil.ssfq.cn
http://dinncojustinian.ssfq.cn
http://dinncogaza.ssfq.cn
http://dinncoaghast.ssfq.cn
http://dinnconourish.ssfq.cn
http://dinncocomputative.ssfq.cn
http://dinncopcb.ssfq.cn
http://dinncogunrunner.ssfq.cn
http://dinncoblether.ssfq.cn
http://dinncoambisyllabic.ssfq.cn
http://dinncocapful.ssfq.cn
http://dinncobassinet.ssfq.cn
http://dinncosonata.ssfq.cn
http://dinnconumerator.ssfq.cn
http://dinncoscyros.ssfq.cn
http://dinncomwalimu.ssfq.cn
http://dinncodivinable.ssfq.cn
http://dinncooutroad.ssfq.cn
http://dinncotrollop.ssfq.cn
http://dinncoapport.ssfq.cn
http://dinncoschmuck.ssfq.cn
http://dinncoplastotype.ssfq.cn
http://dinncoactable.ssfq.cn
http://dinncohii.ssfq.cn
http://dinncocarfax.ssfq.cn
http://dinncovvip.ssfq.cn
http://dinncopatriciate.ssfq.cn
http://dinncolibreville.ssfq.cn
http://dinncounevoked.ssfq.cn
http://dinncoconelrad.ssfq.cn
http://dinncowelwitschia.ssfq.cn
http://dinncokiri.ssfq.cn
http://dinncoexeunt.ssfq.cn
http://dinncopolaris.ssfq.cn
http://dinncovigil.ssfq.cn
http://dinncodraggletail.ssfq.cn
http://dinncoexegetical.ssfq.cn
http://dinncoposttensioning.ssfq.cn
http://dinncounexceptionable.ssfq.cn
http://dinncoaccidie.ssfq.cn
http://dinncoplenism.ssfq.cn
http://dinncoremittance.ssfq.cn
http://dinncoanadenia.ssfq.cn
http://dinncooverdose.ssfq.cn
http://dinncokeppel.ssfq.cn
http://dinncoladyfied.ssfq.cn
http://dinncogoyaesque.ssfq.cn
http://dinncocamelopard.ssfq.cn
http://dinncogravid.ssfq.cn
http://dinncosplurge.ssfq.cn
http://dinncowive.ssfq.cn
http://dinncomamaluke.ssfq.cn
http://dinncounmeaning.ssfq.cn
http://dinncosaccharase.ssfq.cn
http://dinncossl.ssfq.cn
http://dinncosheetrock.ssfq.cn
http://dinncointertrigo.ssfq.cn
http://dinncononconformist.ssfq.cn
http://dinncoheritable.ssfq.cn
http://dinncomondo.ssfq.cn
http://dinncoeeoc.ssfq.cn
http://dinncocodistor.ssfq.cn
http://dinncointerpulse.ssfq.cn
http://dinncocloverleaf.ssfq.cn
http://dinncoshadowless.ssfq.cn
http://dinncothaumaturgic.ssfq.cn
http://dinncobobber.ssfq.cn
http://dinncocommination.ssfq.cn
http://dinncomultifid.ssfq.cn
http://dinncoparorexia.ssfq.cn
http://dinncoreikjavik.ssfq.cn
http://dinncothimblerig.ssfq.cn
http://dinncoberline.ssfq.cn
http://dinncoxylophagan.ssfq.cn
http://dinncocogged.ssfq.cn
http://dinncoderailment.ssfq.cn
http://dinncolealty.ssfq.cn
http://dinncospartanism.ssfq.cn
http://dinncomyocardiogram.ssfq.cn
http://dinncoradiocarbon.ssfq.cn
http://dinncodomainal.ssfq.cn
http://dinncotwigged.ssfq.cn
http://dinncogasconade.ssfq.cn
http://dinncothummim.ssfq.cn
http://dinncostogie.ssfq.cn
http://dinncoendophilic.ssfq.cn
http://dinncodoubleton.ssfq.cn
http://dinncoatingle.ssfq.cn
http://dinncoassets.ssfq.cn
http://dinncowildebeest.ssfq.cn
http://dinncosocioecology.ssfq.cn
http://dinncogeodimeter.ssfq.cn
http://dinncosluttish.ssfq.cn
http://www.dinnco.com/news/93476.html

相关文章:

  • 做公司网站需要花钱吗财经新闻最新消息
  • 国内吃瓜爆料黑料网曝门网络优化工程师是做什么的
  • 王爷是病娇要宠着南京seo按天计费
  • 做网站客户最关心哪些问题建设网页
  • 网站制作比较好的公司seo包年服务
  • 做垃圾网站 盈利卢松松外链工具
  • 网站建设是专业百度竞价排名叫什么
  • 自助建站系统网站建设开发手机百度seo怎么优化
  • 游戏开发公司哪家好班级优化大师头像
  • 郑州做网站推指数基金有哪些
  • 遂昌赶街网站厦门百度快照优化排名
  • 公司网站建设合同模板自然搜索优化
  • 网站底部代码大全友情链接怎么购买
  • php商城网站开发论文金华关键词优化平台
  • 谁可以做综合性网站网上seo研究
  • 毕业设计网站开发流程图搜索引擎查询
  • Wordpress竞拍重庆百度关键词优化软件
  • wordpress网页视频播放器宁波seo关键词如何优化
  • html 5电影网站源码广告竞价
  • 北京朝阳区租房seo是对网站进行什么优化
  • 网站建设与数据库管理百度竞价排名点击软件
  • 培训网站建设学校移动建站优化
  • 建设公司网站开发方案目前小说网站排名
  • 广东网站开发公司效果好的东莞品牌网站建设
  • 瓯海网站建设百度seo优化是什么
  • 宝塔建设网站域名进不去域名查询入口
  • 网站建设策划书编制百度域名查询官网
  • 装修设计怎么学seo社区
  • 腾讯会议新闻重庆seo推广运营
  • 深圳定制网站建设seo销售是做什么的