1:sortList nList= new List(); new List(sortStrings).ForEach(e => { nList.Add(int.Parse(e)); }); Item.Sort( (a, b) => { return nList.FindIndex(s => s =...
分类:
编程语言 时间:
2015-07-22 18:02:49
阅读次数:
110
在angularjs的controller中一段代码,展示如下:var sortList = new SortList();sortList.setSorts([$scope.year_invest_sort]);$scope.sorts = sortList.getSorts();$scope.b...
分类:
Web程序 时间:
2015-06-28 23:01:44
阅读次数:
162
/// /// 对集合进行排序,如 /// List users=new List(){.......} /// ListSorter.SortList,Person>( users,"Age",SortDirection.Ascending); /// pub...
分类:
编程语言 时间:
2015-06-09 23:21:59
阅读次数:
121
Title:Sort a linked list inO(nlogn) time using constant space complexity.思路:考虑快速排序和归并排序,但是我的快速排序超时了ListNode* sortList(ListNode* head) { if (!he...
分类:
其他好文 时间:
2015-05-25 16:21:19
阅读次数:
153
简单算法O(n^2):冒泡法=i;j--) { if(sortList[j]sortList[j]) minIndex=j; } if(minIndex!=i) swap(sortList,i,minIndex); }}直接插入排序 1 void DirectInsertionS...
分类:
编程语言 时间:
2015-04-28 22:28:20
阅读次数:
157
1.集合的类型要实现IEnumerator,IEnumerable接口的才能使用foreach。集合的类型包括array arraylist list hasTabale dictionary sortList stack queue2.Arraya.一般数组 int[] a=new int[4];...
很简单一道题,就是细节容易出错,必然是二分才有nlogn的速度public class Solution { public ListNode sortList(ListNode head) { // 跟merge sort 一模一样 http://www.cnblogs.com/...
分类:
其他好文 时间:
2015-04-10 07:02:27
阅读次数:
98
#coding:utf-8import os;def SortList(item): return item[1];def ReadSize(fileName): return float(os.path.getsize(fileName));def WriteAll(path): l = [] l...
分类:
编程语言 时间:
2015-04-01 17:11:38
阅读次数:
188
思路:用归并排序。对一个链表采用递归进行二等分,直到每个部分有序,然后对其进行合并。其实就是两步,先分解,然后合并有序链表。代码://对链表采用递归排序class Solution {public: ListNode* sortList(ListNode* head){ if(h...
分类:
编程语言 时间:
2015-03-31 00:23:10
阅读次数:
224
Sort List问题:Sort a linked list inO(nlogn) time using constant space complexity.思路: 归并排序我的代码:public class Solution { public ListNode sortList(ListN...
分类:
其他好文 时间:
2015-03-11 21:30:59
阅读次数:
165