
数据结构与算法
Shijie Peng
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
STL概括!
1.list:双向循环链表list l;链表节点分散,对于迭代器,只能“++”或“--”,而不能“+n”或“-n”,此处与vector不同方法:push_front(新数据) 往首部插入新元素push_back(新数据) insert(iterator,新元素)往迭代器位置插入新元素 pop_front(数据)pop_back(数据)erase(迭代器)原创 2018-02-06 22:10:25 · 199 阅读 · 0 评论 -
算法竞赛入门经典p8.1 最大连续子序列和的O(n3) O(n2) O(nlogn) O(n)
T(n) = O(n3)best = A[1];for(int i = 1;i for(intj = i;j intsum = 0; for(intk = i;k sum+= A[k]; if(sum> best)原创 2018-02-07 15:21:07 · 513 阅读 · 0 评论 -
八皇后问题
八皇后问题(回溯法)不考虑棋盘对称,共有92种方法 方法一:O(n2) #include<stdio.h>#include<iostream>using namespace std;int tot = 0,n = 8;int C[8];void search(int cur);int main(){ search(0); cout<<to...原创 2018-03-19 09:20:18 · 220 阅读 · 0 评论 -
c语言回车结束输入
方法一:#include<stdio.h> int main(){ intcount1=0; intcount2=0; intnum; charch; do{ scanf("%d",&num); if((num%2)==0)count...转载 2018-03-20 09:07:08 · 61427 阅读 · 3 评论 -
c标准库函数
详细内容:http://c.biancheng.net/cpp/u/stdlab_h/C语言atoi()函数:将字符串转换成int(整数)头文件:#include <stdlib.h>atoi() 函数用来将字符串转换成整数(int),其原型为:int atoi (const char * str);【函数说明】atoi() 函数会扫描参数 str 字符串,跳过前面的空白字符(例如空格...转载 2018-03-20 14:13:11 · 608 阅读 · 0 评论 -
c++标准库
统一只使用第一个函数的第一个参数即可转载 2018-03-20 14:32:02 · 238 阅读 · 0 评论 -
杭电六度空间
#include<iostream>#include<stdio.h>#include<stdlib.h>#include<string.h>using namespace std;int a[10001][10001];//顶点从1开始编号int visited[10001];//visited数组用来表示某条边是否被访问 int N,M,coun...转载 2018-03-26 11:55:34 · 330 阅读 · 2 评论