摘要:
Sort a linked list inO(nlogn) time using constant space complexity.分析:题目要求时间复杂度为O(nlogn),所以不能用quickSort(最坏O(n^2)),可以使用mergeSort.对一个链表进行归并排序,首先注意归并排序的基... 阅读全文
摘要:
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.分析:思路比较简单... 阅读全文
摘要:
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... 阅读全文