单链表反转:1->2->3->4...
思路:先将1指向3,2指向1,结果为2->1->3->4,然后循环将3插入到2之前
void reverseLinkedList(List head)
{
List tmp,p;
if(head==null)
{
return ;
}
tmp=head->next;
while(tmp->next !=null){
p=tmp->next...
分类:
其他好文 时间:
2014-09-29 17:58:28
阅读次数:
175
(坦率的说,这道题目感动了我, 让我这个编程新手体验到了逻辑的美)原题地址:https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/题意: 1 / \ 2 ...
分类:
编程语言 时间:
2014-09-29 03:08:16
阅读次数:
273
#include#include #include"windows.h"using namespace std;struct StaticLinkNode{ int data; int next;};struct StaticLink{ StaticLinkNode* nodes;...
分类:
其他好文 时间:
2014-09-28 16:13:23
阅读次数:
135
给你机会发出声音,但是不给你机会证明高层的决定是错的RT: 时间复杂度O(n) 空间复杂度O(1)原理就是有指针指向父节点和当前的节点,左孩子必指向右孩子,右孩子必指向父节点的下一个节点的左孩子void Solution::yahooTree(TreeNode *root){ if (root...
分类:
其他好文 时间:
2014-09-28 15:36:12
阅读次数:
201
#include
using namespace std;
template
class Queue
{
public:
Queue()
{
Node *node=new Node();
node->data=NULL;
node->next=NULL;
qfront=qrear=node;
}
template
struct Node
{
Node *next...
分类:
编程语言 时间:
2014-09-28 15:22:52
阅读次数:
126
树链剖分水过,单点修改,树状数组即可。#include #include #include #include #include #define N 250100using namespace std;int n, m, nowplace = 0;int p[N] = {0}, next[N], .....
分类:
其他好文 时间:
2014-09-28 14:26:52
阅读次数:
171
1. 在OSC@China申请账号,建立项目2. MyEclipse中选择导入项目-->Git-->Projects from Git3. 填入Git的地址、User Name和Password,然后选择master分支,将master分支合并到本地4. Next后选择New Project Wiz...
分类:
系统相关 时间:
2014-09-28 00:33:20
阅读次数:
481
贴一个我实现的kmp,在这里我的next数组的定义是,上一个前缀和我当前前缀相同的位置应该在哪里,next[0]=-1 ababac的next数组就是-1,-1,0,1,2-1 #include<iostream>
using?namespace?std;
int?next[...
分类:
其他好文 时间:
2014-09-27 23:41:21
阅读次数:
149
Scanner的工作方式
nextInt,nextDouble,next等都是令牌读取方法。nextLine不是令牌读取方法。...
分类:
编程语言 时间:
2014-09-27 16:51:00
阅读次数:
167
1. 单击Setup应用程序,出现以下界面,如图:2. 单击License Manager,出现如下界面:单击“Next”,出现如下界面:选择“I accept the terms of the license agreement”,然后单击“Next”,如下如下界面:通过单击“Change”处可以...
分类:
其他好文 时间:
2014-09-27 14:50:10
阅读次数:
1179