- 博客(12)
- 资源 (1)
- 收藏
- 关注
原创 最大子序列和问题
//最大子序列和问题Maximum Subsequence Sum #include <iostream> #include<vector> using namespace std;//使用命名空间/*************T(N)=O(N^3) Cubic************/int maxSubSum1(const vector<int> ...
2019-02-25 23:40:05 84
原创 Fibonacci的四种求解方法
//Fibonacci Sequence的使用 #include <iostream> using namespace std;//使用命名空间/*************T(N)=O(N^2)=T(N-1)+T(N-2)+2************/int fib2(int n){ if(n<=1)return n; else return fib2(n-1)+f...
2019-02-25 21:56:13 191
原创 STL中vector的使用
STL中vector//vector的使用 #include <iostream> #include<vector> using namespace std;//使用命名空间int main(){ vector<int> v1; vector<double> v2(10); vector<double> v3(v2);...
2019-02-25 19:55:00 162
原创 类的应用示例+继承
//类的应用示例 #include &lt;iostream&gt; using namespace std;//使用命名空间class student{ /****constructor initializer list 构造函数初始化列表****/ public: student():stu_num(0),stu_score(0){} student(int num):stu...
2019-02-21 23:08:31 440
原创 Function pointer and pointer function指针函数和函数指针
//指针函数int *f(int x, int y){} //pointer function//f is a function, it returns a pointer//函数指针int (*f)(int x, int y){} //function pointer//f is a pointer, it points to a function程序示例//函数指针的使用 ...
2019-02-21 22:18:15 294
原创 数组与指针的区别
1 Array and Pointerint *a1[3] :It is an array, each element is a pointerint (*a2)[3] : It is a pointer. It points to an array with 3 elements2 Array and Pointerint a[10]={1,2,3};int *b=a;b++;...
2019-02-20 22:07:32 63
原创 时间复杂度与空间复杂度
时间复杂度与空间复杂度1 Running time:时间复杂度—T(n)=O(f(n))时间复杂度:算法执行时间随规模增大而增长的趋势。以算法中重复执行的次数作为算法时间复杂度的依据。计算机科学中,算法的时间复杂度是一个函数,它定量描述了该算法的运行时间。这是一个关于代表算法输入值的字符串的长度的函数。时间复杂度常用大O符号表述,不包括这个函数的低阶项和首项系数。使用这种方式时,时间复杂...
2019-02-20 17:09:48 118
原创 模板template的使用
//C++与C的不同点 :模板template的使用 #include &lt;iostream&gt; //无需加上".h "using namespace std;//使用命名空间template&lt;typename T&gt; //定义模板类型 T f(T &amp;a,T &amp;b){ return a&gt;b?a:b;}in
2019-02-20 15:56:39 154
原创 C++程序设计实践指导——第一章 简单编程 (1)
/*C++程序设计实践指导 第一章 简单编程 1.1删除序列中相同的数*/#include&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;iostream&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;#include&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;iomanip&amp;amp
2019-02-02 18:04:26 921 6
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人