摘要:
题目一: 转圈遍历一个矩阵Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]You ... 阅读全文
摘要:
Sort List Sort a linked list in O(n log n) time using constant space complexity 在nlogn的复杂度下对一个链表进行排序。 思路:在底层数据实现的条件下能达到nlogn复杂度的排序方法有以下几种, 快排,在单链表条件下实现,有一个high--的倒退动作无法完成(或者说这个动作的完成本身就需要O(n)的复杂度) 归并排... 阅读全文