摘要: //两数交换不用中间变量public class TwoChange { public static void main(String[] args) { int a = 3, b = 5; //第一种方式采用加减法实现 /* a = a + b; b = a - b; a = a - b;*/ / 阅读全文
posted @ 2019-04-27 16:32 jason小蜗牛 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 快速排序是冒泡排序的改进,效率比较高,基本思想也是两两相比较。 阅读全文
posted @ 2019-04-27 16:24 jason小蜗牛 阅读(198) 评论(0) 推荐(0) 编辑
摘要: //冒泡排序//冒泡排序要经过N-1步的中间排序才能排完,效率较低public class BublleSort { public static void main(String[] args) { int[] arr = {1, 56, 36, 74, 2, 6, 3, 21, 5}; bubbl 阅读全文
posted @ 2019-04-27 14:57 jason小蜗牛 阅读(182) 评论(0) 推荐(0) 编辑