摘要: Good for array and linked list. Stable Sort.Time Complexity: Best, Average, Worst => O(nlogn);Space Complexity: O(n), in-place merge sort makes it ver... 阅读全文
posted @ 2015-01-04 12:32 新一代的天皇巨星 阅读(276) 评论(0) 推荐(0)
摘要: Insertion Sort:Time Complexity: Best O(n) (when already sorted); Average O(n^2); Worst O(n^2).Space Complexity: O(1) public static void main(String... 阅读全文
posted @ 2015-01-04 10:11 新一代的天皇巨星 阅读(244) 评论(0) 推荐(0)
摘要: Algorithm 1:public static void main(String[] args) { int[] a = new int[]{1,2,3,4,5,6,7,8,9,10,11,12}; shiftN2(a, 1); System.ou... 阅读全文
posted @ 2015-01-04 07:23 新一代的天皇巨星 阅读(197) 评论(0) 推荐(0)