- 博客(46)
- 收藏
- 关注
原创 查询redis主从类型
查询redis主从类型redis-cli -h 127.0.0.1 -p 6380 -a cluster info Replication
2022-01-06 17:20:07 391
原创 编译安装vim
vim-8.2.3217]$ ./configure --with-features=huge --enable-rubyinterp=yes --enable-luainterp=yes --enable-perlinterp=yes --enable-python3interp=yes --enable-pythoninterp=yes --with-python-config-dir=/usr/lib64/python2.7/config --with-python3-config-dir=/usr/
2021-08-04 20:16:57 528
原创 源码编译安装gcc
源码安装gcc 解压进入目录./contrib/download_prerequisites下载依赖../gcc-releases-gcc-10.3.0/configure --prefix=/home/lc/usr/gcc --enable-threads=posix --disable-checking --enable--long-long --with-system-zlib --enable-languages=c,c++,go --disable-multilib生产makefile,
2021-07-25 22:41:45 252
原创 排序
#include <iostream>#include <stack>#include <cstdlib>#include <cstring>#include <cstdio>#include <cassert>void PrintArr(int arr[], int n){ for(int i = 0; ...
2019-09-06 14:59:17 122
原创 C语言练习三
#define _CRT_SECURE_NO_WARNINGS 1#include<stdio.h>////100-200素数//int main()//{// int i;// int k;// int count=0;// for(i=100;i<=200;i++)// {// for(k=2;k<i;k++)// {//...
2019-08-19 15:24:48 193
原创 学生管理系统
#define _CRT_SECURE_NO_WARNINGS 1#define _CRT_SECURE_NO_WARNINGS 1#include <cstdio>#include <cstdlib>#include <cstring>#include <iostream>using namespace std;#define D...
2019-08-19 15:23:26 83
原创 顺序表
//#ifndef __SEQ_H__//#define __SEQ_H__////#include<stdio.h>//#include<assert.h>//#include<stdlib.h>////typedef int Data Type;//typedef struct SeqList//{// DataType *arr;//...
2019-08-19 15:15:17 81
原创 C语言练习题二
#define _CRT_SECURE_NO_WARNINGS 1#include<stdio.h>#include<stdio.h>////使用宏实现两个数中求较大值//#define MAX(a,b) (a)>(b)?(a):(b)////int main()//{// int max = MAX(3,4);// printf("max = ...
2019-08-19 15:13:28 1107
原创 C语言练习题一
#define _CRT_SECURE_NO_WARNINGS 1#include<stdio.h>//求n!//int main()//{// int i = 0;// int j = 0;// int ret=1;// scanf("%d",&j);// for(i=1;i<=j;i++)// {// ret=ret*i;// }// p...
2019-08-19 15:04:59 191
原创 栈和队列
#pragma once#include<stdio.h>#include<assert.h>#include<stdlib.h>#include<windows.h>typedef int DataType;//typedef char DataType;//动态顺序栈typedef struct Stack{ Data...
2019-08-19 14:54:13 97
原创 链表面试题
#pragma once#define _CRT_SECURE_NO_WARNINGS 1#include<stdio.h>#include<stdlib.h>#include<assert.h>typedef int DataType;typedef struct SlistNode{ struct SlistNode *_next; ...
2019-08-19 14:50:02 117
原创 二叉树
#pragma once#include<stdio.h>#include<malloc.h>#include<assert.h>#include<stdlib.h>#include<string.h>#include"Queue.h"#include"Stack.h"typedef char BTDataType;...
2019-08-19 14:36:35 109
原创 关于解决centos7安装YCM插件出现的错误:Failed connect to go.googlesource.com:443; refused to connect.
fatal: 无法访问 ‘https://go.googlesource.com/tools/’:Failed connect to go.googlesource.com:443; 拒绝连接fatal: 无法克隆 ‘https://go.googlesource.com/tools’ 到子模组路径 ‘~/.vim/plugged/YouCompleteMe/third_party/ycmd/t...
2019-07-30 11:53:56 3701
原创 STL-容器的简单应用
#include<iostream>using namespace std;#if 0#include<vector>void TestVector1(){ vector<int> v1; //空vector vector<int> v2(20); //指定大小为20 的vector //定义一个vector,用数组arr进行...
2019-07-19 20:50:23 113
原创 C++强制类型转换
#include<iostream>using namespace std;//static_cast、reinterpret_cast、const_cast、dynamic_cast#if 0//static_cast//static_cast用于非多态类型的转换(静态转换),编译器隐式执行的任何类型转换//都可用static_cast,但它不能用于两个不相关的类型进行...
2019-07-18 16:48:33 77
原创 C++智能指针
#include<iostream>using namespace std;#if 0void _MergeSort(int* a, int left, int right, int* tmp){ if (left >= right) return; int mid = left + ((right - left) >> 1); _MergeSo...
2019-07-18 13:52:31 77
原创 C++多态
#include<iostream>using namespace std;#if 0//多态的概念:通俗来说,就是多种形态,具体点就是去完成某个行为,当//不同的对象去完成时会产生出不同 的状态//在继承中要构成多态还有两个条件://1. 调用函数的对象必须是指针或者引用。//2. 被调用的函数必须是虚函数,且完成了虚函数的重写。//虚函数:就是在类的成员函数的...
2019-07-13 02:49:56 104
原创 C++继承
#include<iostream>using namespace std;#if 0class Person{public: void Print() { cout << "name:" << _name << endl; cout << "age:" << _age << endl; ...
2019-07-12 17:26:03 96
原创 写时拷贝
#define _CRT_SECURE_NO_WARNINGS 1#include<iostream>using namespace std;#include<string.h>#include<windows.h>#if 0class String{public: String(const char* str = "") :_str(...
2019-06-30 17:04:37 92
原创 深浅拷贝
#define _CRT_SECURE_NO_WARNINGS 1#include<iostream>using namespace std;#include<string.h>#if 0//简单的赋值浅拷贝class String{public: String(const char* str) :_str(new char[strlen(st...
2019-06-22 11:26:38 61
原创 C++六(模板初阶)
#include<iostream>//泛型编程:编写与类型无关的通用代码,是代码复用的一种手段。模板是泛型编程的基础//模板:1.函数模板 2.类模板//函数模板格式//template<typename T1, typename T2, ......, typename Tn> //typename 可以换成class//返回值类型 函数名(参数列...
2019-04-30 18:56:21 104
原创 单列模式
//使用设计模式的目的:为了代码可重用性、让代码更容易被他人理解、保证代码可靠性。//设计模式使代码编写真正工程化;设计模式是软件工程的基石脉络,如同大厦的结构一样//9.单列模式//一个类只能创建一个对象,即单例模式,该模式可以保证系统中该类只有一个实例,//并提供一个访问它的全 局访问点,该实例被所有程序模块共享。比如在某个服务器程序//中,该服务器的配置信息存放在一个文件 中,...
2019-04-26 20:15:00 129 1
原创 C/C++动态内存管理
#include<iostream>using namespace std;//1.C语言中的动态内存管理//malloc/calloc/realloc/free#if 0#include<stdlib.h>int main(){ int* p1 = (int*)malloc(sizeof(int)); free(p1); //malloc/ca...
2019-04-26 14:59:26 314
原创 C++类和对象(下)
#include<iostream>using namespace std;#include<stdlib.h>//初始化成员列表//初始化列表:以一个冒号开始,接着是一个以逗号分隔的数据成员列表,//每个"成员变量"后面跟一个放在括 号中的初始值或表达式//在创建对象时,编译器通过调用构造函数,给对象中各个成员变量一个合适的初始值//虽然构造函数调用之...
2019-04-24 10:52:21 99
原创 C++类和对象(中)
#define _CRT_SECURE_NO_WARNINGS 1;#include<iostream>using namespace std;#include<stdlib.h>#if 0//构造函数是一个特殊的成员函数,名字与类名相同,//创建类类型对象时由编译器自动调用,保证每个数据成员 都有 一个合适的初始值,//并且在对象的生命周期内只调用一次...
2019-04-23 14:42:22 113
原创 C++类和对象(上)
#define _CRT_SECURE_NO_WARNINGS 1#include<iostream>using namespace std;//C语言中,结构体中只能定义变量,在C++中,结构体内不仅可以定义变量,也可以定义函数。 #if 0#include<stdlib.h>struct Student{ void SetStudentInfo(co...
2019-04-19 20:20:24 103
原创 C++入门(2)
#include<iostream>using namespace std;//命名空间 namespacenamespace N1{ int a = 10; int Add(int left, int right) { return left + right; }}//命名空间可以嵌套namespace N2{ int a = 20; int ...
2019-04-17 15:19:39 57
原创 C++入门基础
C++的简单介绍 C几乎是C++的一个子集,所以C语言支持的语法在C++基本都支持并需要使用。C plus plus(C++),所以在C的基础上又有了很多新的特性。C++的关键字 C++98/03关键字C++的数据类型内置类型:c++中这些基本的数据类型也称为内置类型,也就是语言内部已定义的基本类型。 自定义类型:自己用struct/class/enum/union等定义的就是自...
2018-05-15 12:21:00 532
原创 静态哈希
本文哈希函数为:除留余数法。 本文哈希冲突的处理方法: 闭散列:也叫开放地址法,当发生哈希冲突时,如果哈希表未被装满,说明在哈希表中必然还有空位置,那么可以把key存放到表中 “下一个” 空位中去 。 二次探测:二次探查法在表中寻找“下一个”空位置的公式为:Hi+1 = Hi + (i + 1)^2,Hi =H0 + i^2 。化简后为Hi+1 = i * 2 + 1。HashTabl...
2018-05-13 21:36:43 644
原创 二叉树的操作和面试题
BinaryTree.h#pragma once#include&lt;stdio.h&gt;#include&lt;malloc.h&gt;#include&lt;assert.h&gt;#include&lt;stdlib.h&gt;#include&lt;string.h&gt;#include"Queu
2018-04-25 14:26:28 97
原创 VS2017的快捷键
Ctrl + Shift + B = 生成项目 Ctrl + Alt + L = 显示Solution Explorer(解决方案资源管理器) Shift + Alt + A = 添加新项目到项目编辑相关的键盘快捷键 Ctrl + Enter = 在当前行上方插入空行 Ctrl + Shift + Enter = 在当前行下方插入空行 Ctrl +空格键 = 使用IntelliSe...
2018-04-23 21:31:40 261
原创 c语言练习题二:
1.//递归和非递归分别实现求第n个斐波那契数//递归的方法int Fib(int n){ if(n<=2) { return 1; } else { return Fib(n-1)+Fib(n-2); } ...
2018-04-22 21:02:32 176
原创 c语言练习题 一:
1.使用宏实现两个数中求较大值#define MAX(a,b) (a)>(b)?(a):(b)int main(){ int max = MAX(3,4); printf("max = %d\n",max); return 0;}2.写一个宏可以将一个数字的奇数位和偶数位交换#define SWAP(num) (num = ((num ...
2018-04-22 20:51:03 155
原创 栈的应用——逆波兰表达式
//寻找空格int FindSpace(char *rpn, int pos, int len){ for (; pos < len; ++pos) { if (' ' == rpn[pos]) return pos; } return -1;}//逆波兰表达式int ExpressionRPN(char *...
2018-04-22 13:20:08 172
原创 栈的应用——括号匹配
//括号匹配问题void MatchBrackets(char *buf, int len){ Stack s; StackInit(&s); int i = 0; assert(buf); for (i = 0; i < len; i++) { //如果是左括号,则将左括号入栈 if (('(' =...
2018-04-20 22:40:10 280
原创 栈和队列
/////////////////////////////////////////////栈的基本操作//////////////////////////////////////// Stack.h#pragma once#include<stdio.h>#include<assert.h>#include<stdlib.h>#include...
2018-04-20 15:35:36 112
原创 进程概念
程序:为了执行特定任务的一系列指令的有序集合单道程序设计 时钟中断 ——> 进程多道程序设计 分时系统1.硬件中断技术的出现,进而软件上有了分时系统,时间片轮转2.进程:从用户角度看,进程就是程序的一次动态执行过程3.从操作系统(内核)的角度看, (1)进程是操作系统分配内存,cpu时间片等系统资源的基本单位(硬盘不算) (2)每个进程有自己独立的虚拟地址...
2018-04-12 18:41:18 92
原创 linux基础命令
linux基础命令操作系统提供我们的接口:API(函数接口),shell命令,图形界面(鼠标)。主要学习: API 、shell命令查看网是否通:ifconfig (-a eth0),在windows的cmd中:ping + IP地址,ipconfig all | more命令: 命令 [-参数] [参数]1.ls:(以 . 开头的文件都是屏蔽视觉骚扰的...
2018-04-06 20:56:25 109
原创 单链表链表面试题
.h//链表面试题 //打印无头单链表void TailPrintSlist(SlistNode *pHead);//删除非尾节点,不能遍历链表void DeletingNonTailSlist(SlistNode **ppHead, SlistNode *pos); //无头单链表的某节点前插入一个节点,不能遍历链表void PrevPosIsertSlist(Slist...
2018-04-03 14:47:23 128
原创 日期类(c++实现)
Date.h#pragma once#include<iostream>using namespace std;class Date{public: //构造函数 Date(int year = 1900, int month = 1, int day = 1) //:_year(year) //初始化列表 //...
2018-03-30 16:04:01 324
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人