这是什么排序算法的名称?

编程入门 行业动态 更新时间:2024-10-18 16:53:30
本文介绍了这是什么排序算法的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 for(int i=0; i<n-1; i++) { for(int j=i+1; j<n; j++) { if(a[i] > a[j]) { /* Swap a[i] and a[j] */ } } }

PS 给定一个算法的名称,人们可以很容易地找到相应和源$ C ​​$ C。但是,我觉得很难做到,反之亦然:D

P.S. Given the name of an algorithm, one can easily find relevent source code. But I find it hard to do the vice-versa :D

修改哦!如果是冒泡排序,那么什么是这个名字:

Edit Oh! If that is bubble sort, then what is the name of this:

for(int i=0; i<n; i++) { for(int j=0; j<n-1; j++) { if(a[j] > a[j+1]) { /* Swap a[j] and a[j+1] */ } } }

我认为这第二个泡沫的更小的元素,所以我想的这个的竟是冒泡排序。如果第一个是冒泡排序,有什么的第二个名字?

I thought this second one "bubbles" the smaller elements up, so I thought this was actually bubble sort. If the first one is bubble sort, what's the name of the second one?

推荐答案

首先是选择排序,你添加第二个是冒泡排序!

First is the Selection Sort and the second one you added is Bubble sort!

更多推荐

这是什么排序算法的名称?

本文发布于:2023-11-29 03:56:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1645196.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:算法   名称   这是什么

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!