上一页 1 2 3 4 5 6 7 ··· 17 下一页
摘要: C++11系列 区间迭代 2013 08 20 在我前面介绍C++11的文章中,我提到C++11将会带来一些实用的改进。我的意思是它将移除一些不必要的打字和其它影响快速编码的壁垒。我前面讲过的auto关键字就是一个例子;现在我想讲一下区间迭代(range based for loop)。 区间迭代的 阅读全文
posted @ 2019-09-03 15:19 xjyxp01 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 一、说明 queue 是一种队列适配器,专门设计用于FIFO中操作(先进先出),元素从一端插入容器并从另一端提取。 相关API地址为:http://www.cplusplus.com/reference/queue/queue/ 二、使用方法 在C++中只要 include<queue> 阅读全文
posted @ 2019-09-03 14:38 xjyxp01 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 1、Stack的常用用法 stack:栈,一个后进先出的容器。 1.1、stack的定义 加上头文件 include<stack>和using namespace std; stack<typename> sk; 1.2、stack容器元素的访问 stack是一种操作受限制的 阅读全文
posted @ 2019-09-03 14:36 xjyxp01 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 转自csdn的文章,仅作为学习笔记。原文链接:https://blog.csdn.net/weixin_36888577/article/details/79937886   普通的队列是一种先进先出的数据结构,元素在队列尾追加,而从队列头删除。 在优先队列中,元素被赋予优先级。当访问元素 阅读全文
posted @ 2019-09-03 14:35 xjyxp01 阅读(599) 评论(0) 推荐(0) 编辑
摘要: int NumberAppearMoreThanOneHalf(vactor numbers) { if (numbers.empty==0) { return 0; } map m; for(int i=0; i size/2) { return member.first; } } return 阅读全文
posted @ 2019-09-03 10:59 xjyxp01 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Restore IP Addresses Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given&nbsp 阅读全文
posted @ 2019-09-03 10:52 xjyxp01 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 相同点: ①都是C++的字符处理函数,把数字字符串转换成int输出 ②头文件都是 include<cstring> 不同点: ①atoi()的参数是 const char ,因此对于一个字符串str我们必须调用 c_str()的方法把这个string转换成 const 阅读全文
posted @ 2019-09-03 09:57 xjyxp01 阅读(195) 评论(0) 推荐(0) 编辑
摘要: ?123456789 include<string> include<iostream>using namespace std;int main(){ string s("12345asdf"); string a = s.substr(0,5);  &n 阅读全文
posted @ 2019-09-03 09:45 xjyxp01 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 基本排序算法 基于比较的排序 冒泡排序 没什么可说的, 改进方法就是加一个标志位防止有序后重复遍历. 由于需要遍历两次, 所以时间复杂度O(N^2) 传送门 > 冒泡排序 选择排序 外层从0开始默认outer是最小数的下标, 内存从outer+1位置开始遍历, 不稳定, 如{ 3, 3, 3, 阅读全文
posted @ 2019-09-02 16:57 xjyxp01 阅读(407) 评论(0) 推荐(0) 编辑
摘要: 版权声明:本文为博主原创文章,遵循 CC 4.0 BY SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/sinat_30440627/article/details/65448970 平衡数的定义:将一个数分成左右两部分,分别成为2个新数。左右 阅读全文
posted @ 2019-09-02 16:38 xjyxp01 阅读(2159) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 17 下一页