摘要: 和冒泡排序一样,选择排序也是蛮力法的一种实际应用。 选择排序的思想,就是首先扫描整个数组,找到最小的元素,然后和第一个元素进行交换,如此一来就等同于将最小的元素放到它在有序表中最终的位置上。然后从第二个元素开始扫描整个表,找到剩余n-1个元素中最小的元素,与第二个元素交换位置。以此类推,在执行n-1 阅读全文
posted @ 2016-10-13 15:36 Gerrard_Feng 阅读(1443) 评论(0) 推荐(2)
摘要: 问题: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0?Find all unique triplets in the array which gives the sum 阅读全文
posted @ 2016-10-13 10:29 Gerrard_Feng 阅读(262) 评论(0) 推荐(1)