- 博客(11)
- 收藏
- 关注
原创 STL bitset题目
Give you N numbers a[1]...a[n]and M numbers b[1]...b[m]For each b[k], if we can find i,j a[i] + a[j] = b[k] or a[i] = b[k] , we say k is a good number.And you should only output the number of g
2016-05-26 10:04:09 1149
原创 两个队列实现栈功能
key points:template class and function, stack and queue.Description:In this assignment, you need to complete Class Stack's declaration and definition with Template. The different thing is that t
2016-05-21 11:21:43 393
原创 bfs实现迷宫路径最小
You are provided a maze(迷宫), and you need to program to find the least steps to walk from the start to the end.And you can only walk in four directions:up, down,left, right.There will only be 5 ki
2016-05-21 09:52:15 499
原创 栈和队用链表实现
栈是FILO,队是FIFO, 用类实现栈很简单,用链表操作需要注意的是内存问题,下面是用链表实现简单的数据结构--栈和队:stack#include#includeusing namespace std;class Stack { public: Stack() { top_node = NULL; node_
2016-05-17 20:46:41 286
原创 string类大小写转换
经常遇到字符串类型大小写转换,下面用两种方法实现:1. tolower / toupper--头文件#include#include#include#includeusing std::cin;using std::cout;using std::endl;using std::string;using std::set;using std::vector; int
2016-05-17 20:30:33 988
原创 双向链表DouList
双向链表可以跟单向链表比较优点在可以在两边进行添加删除元素 Double类声明及定义:#include struct DouListNode { int elem; DouListNode *prev, *next; DouListNode(int e = 0, DouListNode *p = 0, DouListNode *n = 0) { elem = e;
2016-05-15 23:32:28 409
原创 有关学习编程的网站
1. github (代码托管)2. stackoverflow (编程题目)3. cplusplus (c++网站)4. online judge (编程题目)5. 九度 (编程题目)6. tutorialspoint(在线编译器)7. csdn (你懂)
2016-05-15 22:20:39 546 1
原创 二叉搜索树(递归)
二叉排序树也叫二叉搜索树和二叉查找树,是比较常见的一种二叉树下面是二叉树的简单递归建立与遍历和删除操作方法:#includeusing namespace std;class binary { private: struct node { int data; node* l; node* r; node(i
2016-05-15 22:08:06 455
原创 c/c++栈与队的数组实现方法
stack与queue均为容器适配器,下面使用数组容器实现栈和队的基本操作:stack:class stack {private: int * storage; int max_size; int top;public: stack() { this->storage = new int[MAX_SIZE](); this->max_size = MAX
2016-05-15 22:01:01 465
原创 学习归幷排序
归幷排序基本代码演示:用类封装:public void Merge(int* a, int low, int width, int height) { int i = low, j = width + 1, k= 0; int* array = new int[high - low + 1]; while (i <= width && j <= height) {
2016-05-15 20:48:08 279
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人