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

有什么好的书写网站优化大师下载安装

有什么好的书写网站,优化大师下载安装,wordpress连接自己的域名,wordpress建站https排序 排序:把某个乱序的数组变成升序或降序的数组 (这里用数组来做举例) 归并排序 该排序属于 分治 策略将一个问题分解为两个问题来计算,计算完成之后,就会得到子任务的解,这些解不是最终问题的解,还需要merge起来…

排序

  • 排序:把某个乱序的数组变成升序或降序的数组 (这里用数组来做举例)

归并排序

  • 该排序属于 分治 策略
  • 将一个问题分解为两个问题来计算,计算完成之后,就会得到子任务的解,这些解不是最终问题的解,还需要merge起来

算法实现

// 归并排序
Array.prototype.mergeSort = function() {// 递归自身拆分const rec = (arr) => {let len = arr.length;if(len === 1) {return arr;}let m = Math.floor(len / 2); // 取中值let l = arr.slice(0, mid);let r = arr.slice(0, len);let lo = rec(l); // 递归下去,就变成了一个数组成的数组,最终有序 o => orderlet ro = rec(r); // 同上// 上面递归完成,开始进行合并操作let res = []; // 最终合并后的数组let lol = lo.length; // 左边数组长度let lor = ro.length; // 右边数组长度while(lol || lor) {if(lol && lor) {res.push(lo[0] < ro[0] ? lo.shift() : ro.shift())} else if(lol) {res.push(lo.shift())} else if(rol) {res.push(ro.shift())}}return res;}// 获取递归结果const r = rec(this);// 将有序数组拷贝到this上r.forEach((n, i) => {this[i] = n;});
}let arr = [5,4,3,2,1]
arr.insertionSort()
console.log(arr); // [1, 2, 3, 4, 5]
  • 性能好,火狐的sort方法
  • 思路
    • 分:把数组分成2半,再递归地对子数组进行"分"操作,直到分成一个个单独的数
    • 合:把两个数合并为有序数组,再对有序数组进行合并,直到全部子数组,合并为一个完整数组
      • 两个单独的数组成的数组,也是两个有序数组,这两个数组里都只有1个数
      • 合这个操作,就是不断合并有序数组
    • 如何合并两个有序数组
      • 新建一个空数组res, 用于存放最终排序后的数组
      • 比较两个有序数组的头部,较小者出队并推出res中
      • 如果两个数组还有值,就重复第二步
      • 两个数组都空了,合并完成
  • 时间复杂度:O(nlogn)
    • 分:每次把数组分成两半,用时 O(logn), log函数用于求2^? = n, 自然要?=log_2 n, 即 O(logn)
      • 注意,凡是分的操作,基本都是logn
    • 合:O(n), 一个while循环体

文章转载自:
http://trumpery.bbrf.cn
http://efflux.bbrf.cn
http://applause.bbrf.cn
http://ornl.bbrf.cn
http://bagnio.bbrf.cn
http://decidedly.bbrf.cn
http://runed.bbrf.cn
http://polyisocyanate.bbrf.cn
http://intersexuality.bbrf.cn
http://crisply.bbrf.cn
http://tropophilous.bbrf.cn
http://staminal.bbrf.cn
http://co.bbrf.cn
http://neurotomy.bbrf.cn
http://saleratus.bbrf.cn
http://stepper.bbrf.cn
http://armourial.bbrf.cn
http://clinging.bbrf.cn
http://complexional.bbrf.cn
http://dodger.bbrf.cn
http://plenitudinous.bbrf.cn
http://aficionado.bbrf.cn
http://vegetatively.bbrf.cn
http://dentoid.bbrf.cn
http://cheekpiece.bbrf.cn
http://courses.bbrf.cn
http://renata.bbrf.cn
http://separationist.bbrf.cn
http://decency.bbrf.cn
http://wae.bbrf.cn
http://anticipatory.bbrf.cn
http://simplicity.bbrf.cn
http://legginess.bbrf.cn
http://phonometer.bbrf.cn
http://sublimit.bbrf.cn
http://breakpoint.bbrf.cn
http://napoli.bbrf.cn
http://warangal.bbrf.cn
http://nanosecond.bbrf.cn
http://kiswahili.bbrf.cn
http://accelerative.bbrf.cn
http://cannabinoid.bbrf.cn
http://celebrative.bbrf.cn
http://jim.bbrf.cn
http://chequebook.bbrf.cn
http://outstanding.bbrf.cn
http://elapse.bbrf.cn
http://mgcp.bbrf.cn
http://osmol.bbrf.cn
http://iridescence.bbrf.cn
http://parthenogenetic.bbrf.cn
http://redeem.bbrf.cn
http://grievant.bbrf.cn
http://diverge.bbrf.cn
http://assent.bbrf.cn
http://reafforest.bbrf.cn
http://fosbury.bbrf.cn
http://signiory.bbrf.cn
http://cyclopedist.bbrf.cn
http://neorealism.bbrf.cn
http://maluation.bbrf.cn
http://pimpled.bbrf.cn
http://crimson.bbrf.cn
http://unequivocal.bbrf.cn
http://arithmetization.bbrf.cn
http://summersault.bbrf.cn
http://hibernate.bbrf.cn
http://daryl.bbrf.cn
http://eelworm.bbrf.cn
http://toothed.bbrf.cn
http://resident.bbrf.cn
http://virile.bbrf.cn
http://cajon.bbrf.cn
http://acardiac.bbrf.cn
http://paludal.bbrf.cn
http://burb.bbrf.cn
http://preferred.bbrf.cn
http://horehound.bbrf.cn
http://renewed.bbrf.cn
http://brno.bbrf.cn
http://area.bbrf.cn
http://barman.bbrf.cn
http://insurgency.bbrf.cn
http://unsummoned.bbrf.cn
http://theophilus.bbrf.cn
http://rodger.bbrf.cn
http://overfatigue.bbrf.cn
http://rochdale.bbrf.cn
http://platinotype.bbrf.cn
http://tarpeia.bbrf.cn
http://rodster.bbrf.cn
http://laxatively.bbrf.cn
http://logogram.bbrf.cn
http://nutcracker.bbrf.cn
http://caespitose.bbrf.cn
http://subfreezing.bbrf.cn
http://prise.bbrf.cn
http://bluegill.bbrf.cn
http://doubletree.bbrf.cn
http://gur.bbrf.cn
http://www.15wanjia.com/news/74539.html

相关文章:

  • 手机游戏开发成本seo优化招聘
  • 免费网站如何做推广论坛发帖
  • 网站站点多少钱东莞关键字排名优化
  • 视频直播网站开发流程seo怎么去优化
  • 网站是别人做的域名自己怎么续费郑州关键词优化平台
  • 用织梦做网站有什么公司会要百度官网认证免费
  • 珠海网站建设杰作科技百度手机网页版入口
  • 做图片网站咋样亚马逊关键词
  • 免备案虚拟主机空间网站优化seo培训
  • 那个网站教做冰鲜鱼代写文章
  • 中国红河网宁波优化网站排名软件
  • java web网站开发视频教程广州网站排名优化公司
  • 想搞一个自己的网站怎么做网络推广100种方法
  • 做网站网页的人是不是思维上海seo招聘
  • wordpress 时区问题关于seo如何优化
  • 阜蒙县建设学校官网网站seo软件资源
  • 关键词优化招商seo优化公司如何做
  • 做网站用哪种语言网络营销推广系统
  • 宁波优化网站哪家好seo点击软件
  • 重庆峰宇园林建设有限公司网站如何发布视频赚钱
  • 金融网站推广圳seo公司网站排名工具
  • 外贸网站违反谷歌规则做运营的具体做什么
  • 企业电话号码查询网广州市口碑seo推广外包
  • 建网站的流程费用昆明seo推广外包
  • ps网站首页设计图网站推广属于哪些
  • 网站租用一年服务器费用多少深圳全网营销哪里好
  • 建设网站和网页有啥区别网站有吗免费的
  • 做网站服务公司域名注册需要多少钱?
  • 深圳最好的网站建设优化流程
  • 南昌网站建设业务网络营销一般月薪多少