【题目】
Sort a linked list in O(n log n)
time using constant space complexity.
【分析】
单链表适合用归并排序,双向链表适合用快速排序。本题可以复用Merge Two Sorted Lists方法
【代码】
/*********************************
* 日期:2015-01-1...
分类:
其他好文 时间:
2015-01-13 00:10:40
阅读次数:
184
题目描述
Xinlv wrote some sequences on the paper a long time ago, they might be arithmetic or geometric sequences. The numbers are not very clear now, and only the first three numbers of each seq...
分类:
其他好文 时间:
2015-01-13 00:08:33
阅读次数:
258
linux命令--shutdown名字: shutdown -关闭系统概要: shutdown【OPTION】...TIME(参数)[MESSAGE]描述: shutdown 安排系统以一个安全的方式关机。此时所有在本机上的用户都会被通知系统将被关闭在TIME的最后5分钟,新的登录将被禁止。 TIM...
分类:
系统相关 时间:
2015-01-13 00:01:27
阅读次数:
265
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.
Try to solve it in linear time/space.
Return 0 if the array contains less than 2 elements.
Y...
分类:
编程语言 时间:
2015-01-12 22:34:27
阅读次数:
274
Reverse Nodes in k-GroupGiven a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a...
分类:
其他好文 时间:
2015-01-12 22:27:19
阅读次数:
193
Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.Credits:Special thanks to@tsf...
分类:
其他好文 时间:
2015-01-12 22:25:47
阅读次数:
451
之前我们在一个用于统计函数调用消耗时间的装饰器中写了一个装饰器,用于统计函数调用时间。代码如下: from time import time
from time import sleep def count_time(): def tmp(func): def wrapped(*args, **ka...
分类:
其他好文 时间:
2015-01-12 22:20:50
阅读次数:
196
setInterval(function(){},time);每隔几秒要执行一个动作函数时就需要一个计时器。倒计时:(基于jquery)
分类:
其他好文 时间:
2015-01-12 22:18:32
阅读次数:
144
Follow up for "Find Minimum in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Suppose a sorted array is rotated at some pivot u...
分类:
其他好文 时间:
2015-01-12 21:04:07
阅读次数:
224
日期和时间处理是经常会遇到的事情。什么是Tick?时间间隔是以秒为单位的浮点小数。每个时间戳都以自从1970年1月1日午夜(历元)经过了多长时间来表示。Python附带的受欢迎的time模块下有很多函数可以转换常见日期格式。如函数time.time()用ticks计时单位返回从12:00am, Ja...
分类:
编程语言 时间:
2015-01-12 20:41:45
阅读次数:
476