自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(26)
  • 资源 (1)
  • 收藏
  • 关注

原创 【基础】通过取地址调用虚函数的两种方式--C++源代码(VS2008)

#include using namespace std;class Base{public:virtual void func_1(){cout}virtual void func_2(){cout}};/* 直接调用对应类中的函数 */typedef void (Base::*FUNC_1)();/* 直接调用对应的函数

2017-11-23 13:04:46 425

原创 【基础】队列的插入和删除--C++源代码(g++ 7.2.0)

#include using namespace std;struct Node{        int data;        Node* next;};struct Deque{        Node* first;        Node* rear;};Deque* insert(Deque* pDeque, int data

2017-11-11 18:59:06 808

原创 【算法】约瑟夫问题--C++源代码(g++ 7.2.0)

1  #include      2  using namespace std;     3     4  struct Node     5  {     6          int data;     7          Node* next;     8  };     9    10  void Josephus(int total, int m ,

2017-11-10 11:59:04 941

原创 【基础】查看程序运行所需时间--C++源代码(g++ 4.9.3)

#include #include using namespace std;int func(){        return 0;}int main(){        timeval start,end;        gettimeofday(&start,NULL);        for(int i=0;i

2017-11-08 12:35:07 692

原创 【算法】Shell排序--C++源代码(VS2015)

#include #include using namespace std;int interval[] = { 1,3,5,7,9 };void Print(int* arr, int size){    int i;    for (i = 0; i     {        printf("%d ,", *(arr + i));    } 

2017-11-01 21:42:56 390

原创 【基础】简析浅拷贝与深拷贝--C++源代码(VS2015)

#include #include using namespace std;class String{public :    String(const char* str = nullptr);    ~String(void);    String(const String &);    String& operator = (const String&)

2017-11-01 17:14:11 309

原创 【算法】分而治之(DivideAndConquer) -- C++源代码(VS2015)

#include using namespace std;int Max3(int A, int B, int C){    return A > B ? (A > C ? A : C) : (B > C ? B : C);}int DivideAndConquer(int arr[], int left, int right){    if (left =

2017-10-25 16:39:19 732

原创 【LeetNode2-1-10】Four sum--C++源代码(VS2015)

#include #include #include #include using namespace std;/*Four sum*/vector> Solution(vector &vec,const int target){vector> result;if (vec.size() return result;unordered

2017-10-05 16:49:46 337 1

原创 【LeetNode2-1-9】Three sum closest--C++源代码(VS2015)

#include #include #include using namespace std;/*three sum*/void QuickSort(vector &vec,int left,int right){if (vec.size() return;if (left > right)return;int first = left;

2017-10-05 16:45:46 269

原创 【LeetNode2-1-8】Three sum--C++源代码(VS2015)

#include #include #include using namespace std;/*Three sum*/void QuickSort(vector &vec,int left,int right){if (vec.size() return;if (left > right)return;int first = left;

2017-10-05 16:43:14 263

原创 【LeetNode2-1-7】Two sum--C++源代码(VS2015)

#include #include #include using namespace std;/*Two sum*/vector Solution(vector &vec, int target){unordered_map Sum;for (int i = 0; i {Sum[vec[i]] = i;}vector result;

2017-10-05 16:35:56 252

原创 【LeetNode2-1-6】Longest consecutive sequence--C++源代码(VS2015)

#include #include #include using namespace std;/*Longest consecutive sequence*/int max(int Num_A, int Num_B){return Num_A > Num_B ? Num_A : Num_B;}int Solution(const vector

2017-10-05 16:33:51 220

原创 【LeetNode2-1-5】Median of two sorted arrays--C++源代码(VS2015)

#include #include using namespace std;/*Median of two sorted arrays*/int min(int Num_A, int Num_B){return Num_A > Num_B ? Num_B : Num_A;}double Find_Median(vector::const_iter

2017-10-05 16:31:46 223

原创 【LeetNode2-1-4】Search in rotated sorted array II--C++源代码(VS2015)

#include #include using namespace std;/*Search in rotated sorted array II允许有重复数据*/int Solution(vector &vec,int target){if (0 == vec.size())return -1;int first = 0;int last

2017-10-05 16:29:16 215

原创 【LeetNode2-1-3】Search in rotated sorted array I--C++源代码(VS2015)

#include #include using namespace std;/*Search in rotated sorted array I有序无重复序列在某一点进行旋转后,在新序列中查找某一个数eg:1,2,3,4,5,6,7 --> 5,6,7,1,2,3,4*/int Solution(vector &vec,int target){if

2017-10-05 16:26:10 222

原创 【LeetNode2-1-2】Remove duplicates from sorted array II--C++源代码(VS2015)

#include #include #include using namespace std;/*Remove duplicates from sorted array II在有序序列中删除重复两次以上数据*/int Solution(vector &vec){if (vec.size() return vec.size();int index

2017-10-05 16:20:34 191

原创 【LeetNode2-1-1】Remove duplicates from sorted array I--C++源代码(VS2015)

#include #include using namespace std;/*Remove duplicates from sorted array I在有序序列中删除重复数据*/int Solution(vector &vec){if (0 == vec.size())return 0;int index = 0;for (int i =

2017-10-05 16:13:22 238

原创 【设计】单例模式--C++源代码(VS2015)

#include #include using namespace std;CRITICAL_SECTION cs;/*单例模式让类自身负责保存它唯一实例。这个类保证没有其他实例被创建,并提供一个访问该实例的方法*/class Singleton{private :int m;Singleton() {}Singleton(const S

2017-09-29 08:47:19 373

原创 【基础】大端小端(Big-endian&Little-endian)--C++源代码(VS2015)

#include using namespace std;/*Little-endian : 数据的低位保存在内存的低地址中,而数据的高位保存在内存的高地址中Big-endian : 数据的低位保存在内存的高地址中,而数据的高位保存在内存的低地址中eg :0x1122Little-endian : 22 11Big-endian : 11 22

2017-09-29 06:29:37 1029

原创 【设计】工厂模式--C++源代码(VS2015)

1. 简单工厂模式--添加新产品需要修改类Factory,违背的类的封装性原则#include #include using namespace std;class Product{public :virtual void Show() = 0;};class ProductA : public Product{public :voi

2017-09-25 16:14:21 283

原创 【基础】随机数生成--C++源代码(VS2015)

#include #include #include using namespace std;void Print(const vector &vec){for (vector::const_iterator iter = vec.begin(); iter != vec.end(); iter++)cout cout }int main(){

2017-09-25 15:45:10 2718

原创 【算法】选择排序--C++源代码(VS2015)

#include #include using namespace std;/*第i轮循环选取关键字最小的记录作为有序序列中第i个记录*/void SelectSort(vector &vec){if (vec.size() == 0)return;int len = vec.size();int temp = 0;for (int i = 0; i

2017-09-25 15:30:12 274

原创 【算法】冒泡排序--C++源代码(VS2015)

#include #include using namespace std;/*function : 数据两两比较,每一轮获取一最大值*/void BubbleSort(vector &vec){if (0 == vec.size())return;int len = vec.size();int len_temp = len;for (in

2017-09-25 14:54:57 467

原创 【算法】斐波那契数列--C++源代码(VS2015)

Fibonacii算法

2017-09-25 11:24:26 925

原创 【算法】快速排序--C++源代码(VS2015)

#include #include using namespace std;void QuickSort(vector &vec, int left, int right){if (left > right){return;}int first = left;int last = right;int key = vec[first];whil

2017-09-25 10:31:33 370

原创 svn服务器的搭建和应用实例

svn 服务器的搭建和应用1. 登录网址:https://www.visualsvn.com/server/download/ ,下载svn服务器    使用快捷键 win+R 点开运行窗口,在运行窗口中输入dxdiag ,进入 DirectX 诊断工具查看电脑位数,从而下载对应位数的svn版本    2. 一直选择下一步直到安装完成(Ps:选择企业版的需要认证码,个人选择的是 S

2016-11-05 20:47:54 521

LeetNode题集和答案

适合C++初级学习者使用,linux下建议使用gcc4.9及以上版本,windows下建议使用virtual studio 2013及以上版本

2017-09-16

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除