- 博客(9)
- 资源 (1)
- 问答 (1)
- 收藏
- 关注
原创 c++二叉排排序树的实现 补上了删除和查找操作
#include #includeusing namespace std;class node{ friend class tree;public: node* left; int data; node* right;};class tree{public: node* root; tree(){ r
2017-06-21 19:04:47
259
原创 c++用模板类封装了队列 提高了可重用性
#include using namespace std;template //定义模板类class Queue{public: Queue(int MaxQueueSize=5); void add(const Type&); Type Delete();private: int tail; int head; Ty
2017-06-08 11:13:01
420
原创 c++实现队列
#include using namespace std;struct node{//节点双向方便找尾指针的前驱 node* pre; int data; node* next;};struct queueL{ node* head;//头指针 node* tail;//尾指针};queueL* init(){ queueL*
2017-06-06 14:41:08
424
原创 利用栈实现逆波兰式求值
为了简便,我这里没有考虑除数为0这些细节#include #include#include #define STACKINITSIZE 100//初始化空间分配量using namespace std;struct Stack{ int* base; int* top; int stackSize;};void createS
2017-06-04 21:01:56
732
原创 顺序栈的c++实现
#include #define STACKINITSIZE 100//初始化空间分配量using namespace std;struct Stack{ int* base; int* top; int stackSize;};void createStack(Stack* s){//创建并初始化 s->top=s->base
2017-06-04 17:18:33
336
原创 c++实现双向有序链表的,增,删,查,合并
#includeusing namespace std;struct DouLinkList{ DouLinkList* pre; int data; DouLinkList* next;};DouLinkList* createLinkList(){//创建一个带头结点的双向链表,头结点数据域记录链表长度 DouLinkList*
2017-06-02 07:57:52
1863
原创 LeetCode 第三题,官方给的标准答案的一个分析,利用空间换时间,将复杂度降到了O(n)
int lengthOfLongestSubstring(string s) { int n = s.length(); int i = 0, j = 0; //i表示当前搜索串的起始位置,j表示当前搜索串的结束位置 int maxLen = 0; bool exist[256] = { false }; //表示当前字符在当前搜索串中有没有出现 wh
2017-06-01 18:12:26
525
原创 leetcode 第三题 小白用最慢的算法做的
class Solution {public: int lengthOfLongestSubstring(string s) { if(s.size()==1) return 1; else{ int a=0; for(int i=0;i for(int j=i+1;j
2017-05-29 23:53:38
360
原创 c++实现链表 增,删,查,合并
#include # includeusing namespace std;struct linkList{ int data; linkList* next;};linkList* createList(){//创建一个带头结点的链表,数据域记录链表长度,初始化为0 linkList* L=new linkList(); L->data
2017-05-29 20:02:49
315
这个问题该怎么解决,大神帮我看看
2014-12-02
TA创建的收藏夹 TA关注的收藏夹
TA关注的人