
C++ STL
Kid_TH
自古英雄出炼狱
从来富贵入凡尘!
展开
-
C++ STL-deque双向队列
C++ STL-deque双向队列deque双向队列是一种双向开口的连续线性空间,可以高效的在头尾两端插入和删除元素,deque在接口上和vector非常相似,下面列出deque的常用成员函数: 代码注释写了//双向队列 #include<deque> #include<cstdio> #include<algorithm> const int MAX_N = 20; using namespac原创 2016-01-11 14:53:33 · 6068 阅读 · 0 评论 -
C++ STL-stack栈的应用
C++ STL-stack栈的应用栈(statck)这种数据结构在计算机中是相当出名的。栈中的数据是先进后出的(First In Last Out, FILO)。栈只有一个出口,允许新增元素(只能在栈顶上增加)、移出元素(只能移出栈顶元素)、取得栈顶元素等操作。在STL中,栈是以别的容器作为底部结构,再将接口改变,使之符合栈的特性就可以了。因此实现非常的方便。下面就给出栈的函数列表和VS2008中栈原创 2016-01-11 16:03:24 · 1013 阅读 · 0 评论 -
C++STL-全排列
C++STL-全排列“ABCDE” AB,AC, AD,AE,BC,BD,BE,CD,CE,DE 诸如此类#include<cstdio> #include<algorithm> #include<iostream> using namespace std; int main() { string s = "ABCDE"; string s1 = s.substr(0, 2);原创 2016-02-16 17:48:43 · 653 阅读 · 0 评论 -
C++STL-list和set
C++STL-list和setlist#include<cstdio> #include<iostream> #include<list> using namespace std; int main() { list<int> a1; list<int>::iterator it; for (int i = 1; i <= 5; i++) { a1.push_b原创 2016-03-04 20:01:44 · 1534 阅读 · 0 评论 -
C++-优先级队列
C++-优先级队列之前做了一道搜索题目,涉及到优先级队列,特地练习记录一下。#include<cstdio> #include<iostream> #include<queue> using namespace std; struct note { int x; int y; int k; friend bool operator < (note a, note b)原创 2016-04-02 12:45:27 · 514 阅读 · 0 评论 -
动态规划:从新手到专家
前言 本文翻译自TopCoder上的一篇文章: Dynamic Programming: From novice to advanced ,并非严格逐字逐句翻译,其中加入了自己的一些理解。水平有限,还望指摘。 前言_ 我们遇到的问题中,有很大一部分可以用动态规划(简称DP)来解。 解决这类问题可以很大地提升你的能力与技巧,我会试着帮助你理解如何使用DP来解题。 这篇文章是基于转载 2016-04-03 18:49:48 · 662 阅读 · 0 评论 -
C++ int转string
C++ int转string第一种方式#include <iostream> #include <string> using namespace std;int main() { int n = 65535; char t[256]; string s; sprintf(t, "%d", n); s = t; cout << s << endl;原创 2016-05-13 17:16:02 · 832 阅读 · 0 评论