- 博客(5)
- 资源 (5)
- 收藏
- 关注
原创 list类的C++模板实现
/*2017/07/20Liu YK*/#pragma once#include <iostream>#include <ctime>#include <cassert>#include <cstdlib>namespace MYSTL{#define ListNodePosi(T) ListNode<T>* typedef int Rank; template<typ
2017-07-26 22:44:34 2081 1
原创 vector模板类的C++实现
/*2017/07/19Liu YK*/#pragma once#include <cassert>#include <iostream>#include <cstdlib>#include <ctime>namespace MYSTL{ typedef int Rank; const int DEFAULT_CAPACITY = 5; template<typ
2017-07-26 22:40:00 4479
原创 寻找数组的第k个最大者
使用了两种解法:将全部元素从大到小排序,然后返回第k-1位置的元素选取前k个元素进行排序,然后将剩余的元素插入到对应位置,没插入一次,抛弃最后一个元素,最后返回最后位置的元素 代码如下:#include <iostream>#include <vector>using namespace std;void bubble_sort(vector<int> &iv);inline void s
2017-07-05 22:40:59 231
原创 单例模式的c++实现
singleton.h文件#ifndef _SINGLETON_H_#define _SINGLETON_H_class Singleton{public: static Singleton* get_instance() { if(!_instance) return new Singleton(); return
2017-07-03 23:30:10 259
原创 mystring类的实现
mystring.h文件#ifndef _CMYSTRING_H_#define _CMYSTRING_H_#include <iostream>#include <cstring>class CMyString{public: //default ctor CMyString(const char *s = nullptr) { if (!s)
2017-07-03 22:32:52 547
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人