Clone GraphClone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are l...
分类:
其他好文 时间:
2014-08-25 22:22:44
阅读次数:
237
#include using namespace std;void swap(int* p,int* q){ int temp = *p; *p = *q; *q = temp;}//快速排序int partition(int *ptr,int first, int last){ ...
分类:
其他好文 时间:
2014-08-25 21:07:04
阅读次数:
268
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.思路: 1 cla...
分类:
其他好文 时间:
2014-08-25 18:38:04
阅读次数:
211
之前写过一篇Json的博客,当时用的是Gson包来解析的,这次来此自带的org.json来解析。传送门:《Gson解析复杂Json数据》JSON的结构 (1) Name/Value Pairs(无序的):类似所熟知的Keyed list、 Hash table、Disctionary和Associa...
分类:
移动开发 时间:
2014-08-25 13:08:24
阅读次数:
316
class Solution {private: vector nodes;public: void recoverTree(TreeNode *root) { nodes.clear(); dfs(root); // 1 5 3 4 2 6 7...
分类:
其他好文 时间:
2014-08-25 01:07:23
阅读次数:
329
TreeTime Limit: 5000MSMemory Limit: 131072KTotal Submissions: 3836Accepted: 1088DescriptionYou are given a tree with N nodes. The tree’s nodes are num...
分类:
其他好文 时间:
2014-08-25 01:06:53
阅读次数:
313
最近有些懒,好久没写代码了,现在写个快排练练手吧。public class QucikSort { //此处交换两个数 public static void swap(int a[],int low,int high) { int temp=a[low]; a[low]=a[high]; a[...
分类:
其他好文 时间:
2014-08-24 20:52:32
阅读次数:
179
递归打印lua中的table,并写到文件里: 1 local pairs_by_keys = function(inTable) 2 local temp = {} 3 for k, v in pairs(inTable) do 4 temp[#temp + ...
分类:
其他好文 时间:
2014-08-23 20:14:11
阅读次数:
218
Description
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following proper...
分类:
其他好文 时间:
2014-08-23 17:46:41
阅读次数:
218
Remove Duplicates from Sorted List II
Total Accepted: 17137 Total
Submissions: 69046My Submissions
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only d...
分类:
其他好文 时间:
2014-08-23 14:00:40
阅读次数:
187