摘要:
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor... 阅读全文
摘要:
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega... 阅读全文
摘要:
再次优化快速排序,三数中值取理想的pivot,三向切分忽略与pivot相同的元素,小数组转插入排序(唯一不足递归实现,不过是尾递归,编译器可以优化掉)代码很短,而且可读性很好,记录于此以供参考const int cutoff = 3;void insertSort(int a[], int len)... 阅读全文
摘要:
void insertSort(int a[], int len){ for (int i = 1; i = 0; --j) { if (a[j] > 1; if (a[left] > a[center]) swap(&a[left], ... 阅读全文