码迷,mamicode.com
首页 >  
搜索关键字:using    ( 53562个结果)
算法练习:两指针之有序数组去重
问题描述 给出一个有序数组,就地移除重复元素,保持每个元素只出现一次,并返回新数组的长度。   问题分析 这个比较简单,直接使用两个指针,一个在前,一个在后,扫描一遍数组即可。时间复杂度为O(n^2)。 比如数组A = { 1,1, 2, 3, 3 },看下图,思想简单明了。       代码实现 #include using namespace std; //去除数组...
分类:编程语言   时间:2015-07-02 22:45:49    阅读次数:244
vector的应用(元素遍历、插入、删除、交换等)
这里主要是对vector容器的一些常见应用的总结。至于vector的构造函数及初始化可以参考http://blog.csdn.net/lsh_2013/article/details/21191289,这里不再赘述。 元素的遍历 用迭代器访问vector元素 #include #include using namespace std; int main(void) { vector v...
分类:其他好文   时间:2015-07-02 22:36:12    阅读次数:549
Insertion Sort List
https://leetcode.com/problems/insertion-sort-list/Insertion Sort ListSort a linked list using insertion sort.题目:插入排序 1 # Definition for singly-linked ...
分类:其他好文   时间:2015-07-02 22:21:54    阅读次数:140
【个人模板】高精度算法
一、求两个高精度正数的和差积 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int MAXN=1000; 7 char s1[MAXN],s2[MAXN]; 8 int ed1,ed2,n1,n2...
分类:编程语言   时间:2015-07-02 22:21:11    阅读次数:205
Sort List
https://leetcode.com/problems/sort-list/Sort ListSort a linked list inO(nlogn) time using constant space complexity.来自http://www.cnblogs.com/zuoyuan/p...
分类:其他好文   时间:2015-07-02 22:15:21    阅读次数:149
mysql登录报错 ERROR 1045 (28000)
1、现象: [root@localhost ~]# mysql -u root -p Enter password:  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 2、原因:数据库中存在空用户所致 3、解决方案: 1)停用mysql服务:# ser...
分类:数据库   时间:2015-07-02 21:12:30    阅读次数:144
二叉查找树-优化版,使用了指针引用
1 //与上一次实现不同,这里使用了大量的指针引用, 2 //因此节省了一个指向父节点的指针 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 template 11 class...
分类:其他好文   时间:2015-07-02 19:16:56    阅读次数:118
C++字符串操作二
#include #include using namespace std; //模拟实现strcmp函数。 bool my_strcmp(const char *str1,const char *str2) { assert(str1!=NULL && str2!=NULL); const char *p = str1; cons...
分类:编程语言   时间:2015-07-02 17:36:16    阅读次数:150
c++ 单词转换 map对象
#include #include #include #include #include #include using namespace std; ifstream& openfile(ifstream &in,const string &filename){ in.close();//close in case it was alrady open in.clear();//...
分类:编程语言   时间:2015-07-02 17:27:48    阅读次数:135
jmap 命令
1.  jmap -heap pid          查看java 堆(heap)使用情况         using thread-local object allocation.         Parallel GC with 4 thread(s)          //GC 方式          Heap Configuration:       //堆内存初始化配置    ...
分类:其他好文   时间:2015-07-02 17:27:39    阅读次数:98
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!