数据结构
ZhangCM_EDC
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++实现list类
#pragma once#ifndef DSA_LIST_H#define DSA_LIST_H#define Posi(T) ListNode* //列表位置节点templatetypename T>struct ListNode//列表节点模板类实现{ T data;//数值 Posi(T)pred;//前驱原创 2018-01-25 21:41:27 · 1240 阅读 · 0 评论 -
C++栈类的实现
#pragma once#ifndef DSA_STACK_H#define DSA_STACK_Htemplatetypename T>class Stack //不需要继承!!!继承的话就不需要里面藏一个deque!!!{private: std::deque Q;public: int size() { return Q.size(); }//返回规模原创 2018-01-25 22:39:53 · 699 阅读 · 0 评论 -
C++简单实现八皇后
bool isvalid(const vectorint>&p, int k){ for (int i = 0; i < k; i++) if (p[i] == p[k] ||abs( p[i] - p[k]) == abs(i - k)) return false; return true;}void rsolve(vectorint原创 2018-01-27 00:20:47 · 315 阅读 · 0 评论 -
Vector类实现(C++)
#pragma once#define DEFAULT_CAPACITY 10templateclass Vector{private:int _capacity ; T*_elem; int _size;//容量默认为10,指向元素的指针,向量的规模public: Vector(int c=DEFAULT_CAPACITY) { _elem = new T[_capacity =原创 2018-01-20 22:27:05 · 789 阅读 · 0 评论 -
leetcode-27. Remove Element--STL Vector remove()和erase()的使用
Given an array and a value, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input array in-plac原创 2018-02-06 00:46:26 · 266 阅读 · 0 评论
分享