Sort ListSort a linked list in O(n log n) time using constant space complexity.使用Merge Sort, 空间复杂度是 O(logN) 因为使用了栈空间。SOLUTION 1:使用Merge Sort来解决问题。为什么不...
分类:
其他好文 时间:
2014-11-29 21:28:58
阅读次数:
203
好坑啊,考试的时候因为一个1分的点卡了很长时间,D题都没有看。坑点在于,直到变化为止,再把这个数组打出来。另外还考察了基本排序算法,merge sort这大概是我第一次写iteration版本,越写越顺,也算是一件好事,insert sort真的是卡了很久,基本功不行,寒假回去看算法书的时候这些算法...
分类:
其他好文 时间:
2014-11-29 20:10:18
阅读次数:
247
Lua学习笔记之tables与bjects
1、 table是Lua中唯一的数据结构,其他语言提供的其他数据比如:arrays、records、lists、queues、sets等,Lua都是通过table来实现的。
2、 数组
在Lua中通过整数下标访问表中的元素即可简单的实现数组,并且数组不必事先指定大小,大小可以随需要动态的增长。
通常我们初始化数组的时候就间接的定义了数组的大小...
分类:
其他好文 时间:
2014-11-29 18:57:57
阅读次数:
130
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.Solution:...
分类:
其他好文 时间:
2014-11-29 07:03:53
阅读次数:
194
Given two sorted integer arrays A and B, merge B into A as one sorted array. Note:You may assume that A has enough space (size that is greater or equa...
分类:
其他好文 时间:
2014-11-29 07:00:12
阅读次数:
193
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2014-11-29 06:59:16
阅读次数:
153
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists: A: ...
分类:
其他好文 时间:
2014-11-29 06:44:17
阅读次数:
137
一.准备已安装NodeJS(Node,npm)二.1.创建工作空间:$mkdir~/workspace/nodejs/
$cd~/workspace/nodejs/
$pwd
/Users/vincent/Desktop/my/workspace/nodejs2.安装express$sudonpminstallexpress-g
express@4.10.4/usr/local/lib/node_modules/express
├──merge-descript..
分类:
Web程序 时间:
2014-11-28 18:36:29
阅读次数:
265
Write a program to find the node at which the intersection of two singly linked lists begins.
For example, the following two linked lists:
A: a1 → a2
↘
...
分类:
其他好文 时间:
2014-11-28 18:24:05
阅读次数:
146
Intersection of Two Linked ListsWrite a program to find the node at which the intersection of two singly linked lists begins.For example, the followin...
分类:
其他好文 时间:
2014-11-28 18:02:19
阅读次数:
144