TreeYou are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the bin...
分类:
其他好文 时间:
2014-07-13 21:24:22
阅读次数:
202
今天做了Leetcode上面一道题Remove Duplicates from Sorted List II,要去去除链表中重复的节点,代码如下 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * ...
分类:
其他好文 时间:
2014-07-13 21:23:10
阅读次数:
160
ECMAScript6对数组进行了扩展,为数组Array构造函数添加了from()、of()等静态方法,也为数组实例添加了find()、findIndex()等方法。下面一起来看一下这些方法的用法。Array.from()Array.from()将类数组(array-like)对象与可遍历的对象转化...
分类:
其他好文 时间:
2014-07-13 20:33:59
阅读次数:
247
这一节主要是发布我自己写的3D曲线,(1)立体flower线圈vertices = 8000a = 10.1b = 3.1s = (a + b) / bo = 4i = from 0 to (40*2*PI)j = mod(i, 2*PI)k = mod(s*i, 2*PI)m = a*sin(j)...
分类:
其他好文 时间:
2014-07-13 20:16:17
阅读次数:
418
Color Me Less
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 30146
Accepted: 14634
Description
A color reduction is a mapping from a set of discrete colors ...
分类:
其他好文 时间:
2014-07-13 17:21:01
阅读次数:
209
首先考虑一个具有几个构造函数的MyClass类。假设我们决定在这个类的私有部分添加一个新的数据成员,称为int_data_:
class MyClass
{
public:
MyClass()
: int_data_(0)
{}
explicit MyClass(const Apple& apple)
: int_data_(0)
{}
MyClass(const stri...
分类:
其他好文 时间:
2014-07-13 16:39:59
阅读次数:
184
Given an integer n, generate a square matrix filled with elements from 1 to n2 in
spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[...
分类:
其他好文 时间:
2014-07-13 16:37:16
阅读次数:
199
比如在插入有序链表的过程中,一般情况下要使用俩指针来遍历,而后还要判断是否在第一个位置插入;利用指针的指针后不需要另外考虑这种特殊情况。
代码:
#include
#include
struct node{
int data;
struct node *next;
} *head;
//sorted link-list
void insert(struct no...
分类:
其他好文 时间:
2014-07-13 15:38:13
阅读次数:
198
天气越来越热,看书还得静得下心啊,今天继续图这一章,概念和算法众多,第一遍看以广度优先的形式为主,以后若要用到具体的算法再去翻“算法导论”吧。下面是学习内容和笔记。图(graph)1.图的存储结构邻接矩阵:顶点数组+边数组(二元);无向图的边数组为对称矩阵,有向图..
分类:
其他好文 时间:
2014-07-13 14:32:18
阅读次数:
214
//错误操作类<?phpclasslog{publicstaticfunctionwrite($err){$fh=fopen(ROOT.‘data/log.txt‘,‘a‘);//追加方式打开,允许从后面追加内容$err=date(‘Y-m-dH:i:s‘,time())."\r\n".$err;fwrite($fh,$err);fclose($fh);}}
分类:
Web程序 时间:
2014-07-13 14:29:16
阅读次数:
249