之前用c语言的方式实现过单链表,现在用c++的方式实现单链表。以c++的类实现单链表,写完代码有了许多不一样的体会。感受到了两种语言的差异。#include<iostream>
usingnamespacestd;
classSlist
{
private:
structNode
{
intdata;
Node*pNext;
};
intsize;
N..
分类:
编程语言 时间:
2016-04-08 01:04:38
阅读次数:
145
/// 去掉字符串中的数字 public static string RemoveNumber(string key) { return Regex.Replace(key, @"\d", ""); } //去掉字符串中的非数字public static string RemoveNotNumber ...
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex ...
分类:
其他好文 时间:
2016-04-08 00:35:32
阅读次数:
198
看到一个问卷不错,拟作为第三次作业的部分内容. int main(void){printf("hello .\n");printf("hello world.\n");return 0;}如果这个程序在第一个printf语句后设置断点就只输出hello,如果在第二个printf语句后设置断点,则两个 ...
分类:
编程语言 时间:
2016-04-07 20:56:31
阅读次数:
293
控制器: //页面静态化(缓存) public function behaviors() { return [ [ 'class' => 'yii\filters\PageCache', 'only' => ['list'], 'duration' => 60, 'variations' => [ ...
分类:
其他好文 时间:
2016-04-07 20:37:07
阅读次数:
121
>mtcars<-function(x,na.omit=FALSE){+if(na.omit)+x<-x[!is.na(x)]+m<-mean(x)+n<-length(x)+s<-sd(x)+skew<-sum((x-m)^3/s^3)/n+kurt<-sum((x-m)^4/s^4)/n-3+return(c(n=n,mean=m,stdev=s,skew=skew,kurtosis=kurt))+}vars<-c("mpg","hp","wt")&g..
分类:
编程语言 时间:
2016-04-07 19:03:58
阅读次数:
1279
Givenabinarytree,determineifitisavalidbinarysearchtree(BST).AssumeaBSTisdefinedasfollows:Theleftsubtreeofanodecontainsonlynodeswithkeyslessthanthenode‘skey.Therightsubtreeofanodecontainsonlynodeswithkeysgreaterthanthenode‘skey.Boththeleftandrightsubtreesmus..
分类:
其他好文 时间:
2016-04-07 18:53:25
阅读次数:
212
题目描述: 给出一个无序的正数数组,找出其中没有出现的最小正整数。 样例 如果给出 [1,2,0], return 3 如果给出 [3,4,-1,1], return 2 如果给出 [1,2,0], return 3 如果给出 [3,4,-1,1], return 2 如果给出 [1,2,0], r ...
分类:
其他好文 时间:
2016-04-07 18:22:53
阅读次数:
210
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. Example Given n = 3, your program should return all 5 u ...
分类:
其他好文 时间:
2016-04-07 13:23:58
阅读次数:
130
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n ...
分类:
其他好文 时间:
2016-04-07 13:18:14
阅读次数:
108