C++实现LeetCode(44.外卡匹配)

[LeetCode] 44. Wildcard Matching 外卡匹配Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and...

2021-08-09

详解C语言中不同类型的数据转换规则

不同类型数据间的混合运算与类型转换1.自动类型转换在C语言中,自动类型转换遵循以下规则:①若参与运算量的类型不同,则先转换成同一类型,然后进行运算②转换按数据长度增加的方...

2021-08-09

C++实现二分法的一些细节(常用场景)

二分法是在一个排好序的序列(数组,链表等)中,不断收缩区间来进行目标值查找的一种算法,下面我们就来探究二分法使用的一些细节,以及常用的场景:寻找一个数;寻找左侧边界;寻找右侧边界...

2021-08-09

C语言-I/O流设计实验

目录前言一、题目二、代码及效果[1]. 第一问[2]. 第二问[3]. 第三问总结前言文件的读取和写入是使用的是fscanf和fprintf两个函数,C语言中文件读取的函数不止这两个。文章中...

2021-08-09

C++并查集常用操作

并查集 是一种树型的数据结构,用于处理一些不相加集合的合并和查询问题。在使用中常常以森林来表示。 并查集也是用来维护集合的,和前面学习的set不同之处在于,并查集能很方...

2021-08-09

C语言中.c和.h文件区别讲解

C语言中.h和.c文件解析    简单的说其实要理解C文件与头文件(即.h)有什么不同之处,首先需要弄明白编译器的工作过程,一般说来编译器会做以下几个过程: 预处理阶段...

2021-08-09

C++实现算法两个数字相加详解

Add Two Numbers 两个数字相加You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order,...

2021-08-09

C++实现LeetCode(206.倒置链表)

[LeetCode] 206.Reverse Linked List 倒置链表Reverse a singly linked list.Example:Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULLFollow up:A linked list ca...

2021-08-09

C++实现LeetCode(205.同构字符串)

[LeetCode] 205. Isomorphic Strings 同构字符串Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the chara...

2021-08-09

C++实现LeetCode(132.拆分回文串之二)

[LeetCode] 132.Palindrome Partitioning II 拆分回文串之二Given a string s, partition s such that every substring of the partition is a palindrome....

2021-08-09

C++实现LeetCode(8.字符串转为整数)

[LeetCode] 8. String to Integer (atoi) 字符串转为整数Implement atoi which converts a string to an integer.The function first discards as many whi...

2021-08-09

C++知识点之inline函数、回调函数和普通函数

目录一、inline内联函数#
1.1 使用#
1.2 编译器对 inline 函数处理步骤#
1.3 优缺点#
1.3.1 优点#
1.3.2 慎用内联#
1.3.3 不宜使用内联#
1.4 虚函数(virtual)可以是内联函数(i...

2021-08-09

VSCode 使用 Code Runner 插件无法编译运行文件名带空格的文件问题

使用 Visual Studio Code 写 C++ 程序最烦心的是大概就是使用 Code Runner 插件无法编译运行文件名带空格的文件了,这个问题困扰了我好久,虽然不影响学习,但太多分隔符总觉得不...

2021-08-09

使用emacs编写C语言教程

如何使用emacs编写c语言程序,并编译运行vi和emacs被分别被称为编辑器之神和神之编辑器。vi的入门精通都很难,emacs入门容易,精通难;vi使用起来不停地切换模式,而emacs则不停地ctr...

2021-08-09

c语言中enum类型的用法案例讲解

11.10 枚举类型在实际问题中,有些变量的取值被限定在一个有限的范围内。例如,一个星期内只有七天,一年只有十二个月,一个班每周有六门课程等等。如果把这些量说明为整型,字符型或...

2021-08-09

C++实现LeetCode(15.三数之和)

[LeetCode] 15. 3Sum 三数之和Given an array S of n integers, are there elements a, b, c in S such that a&#...

2021-08-09

深入理解C++函数栈帧

目录一、什么是函数栈帧二、具体原理2.1 main函数的调用2.2 sum函数的调用参考:一、什么是函数栈帧每一次函数调用都是一个过程,为函数开辟栈空间,用于本次函数调用中临时变量...

2021-08-09

C++实现LeetCode(两个有序数组的中位数)

[LeetCode] 4. Median of Two Sorted Arrays 两个有序数组的中位数There are two sorted arrays nums1 and nums2 of size m and n respectively.Find...

2021-08-09

C++实现LeetCode(131.拆分回文串)

[LeetCode] 131.Palindrome Partitioning 拆分回文串Given a string s, partition s such that every substring of the partition is a palindrome.Return...

2021-08-09

C++实现LeetCode(7.翻转整数)

[LeetCode] 7. Reverse Integer 翻转整数Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123
Output: 321Example 2:Input: -123
Output:...

2021-08-09

C++中nullptr 和 NULL 的区别及用法

1. 为什么会有nullptr的出现目的:nullptr的出现主要是为了替代NULL。那么,为什么要替代NULL呢?在NULL的定义中存在会有2种方式,有的编译器会将NULL定义成0,有的编译器会将NULL定...

2021-08-09

C++实现LeetCode(31.下一个排列)

[LeetCode] 31. Next Permutation 下一个排列Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbe...

2021-08-09

C++实现KDTree 附完整代码

目录简介举例分割的作用一维二维n维关于kdtree的重要问题一.树的建立关键代码简介  k-d树(k-dimensional),是一种分割k维数据空间的数据结构(对数据点在k维空间中划...

2021-08-09

C++实现LeetCode(22.生成括号)

[LeetCode] 22. Generate Parentheses 生成括号Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For...

2021-08-09

C++实现LeetCode(769.可排序的最大块数)

[LeetCode] 769.Max Chunks To Make Sorted 可排序的最大块数Given an array arr that is a permutation of [0, 1, ..., arr.length - 1], we split the ar...

2021-08-09

深入学习C++智能指针之shared_ptr与右值引用的方法

目录1. 介绍2. 初始化方法2.1 通过构造函数初始化2.2 通过拷贝和移动构造函数初始化2.3 通过 std::make_shared 初始化2.4 通过 reset 方法初始化3. 获取原始指针4. 指定删...

2021-08-09

C++高并发内存池的整体设计和实现思路

目录一、整体设计1、需求分析2、总体设计思路3、申请内存流程图二、详细设计1、各个模块内部结构详细剖析2、设计细节三、测试一、整体设计1、需求分析池化技术是计算机中的...

2021-08-09

C++实现LeetCode(20.验证括号)

[LeetCode] 20. Valid Parentheses 验证括号Given a string containing just the characters '(', ')', '{', '}', '[' and ']', deter...

2021-08-09

C++内存池的简单实现

目录一、内存池基础知识1、什么是内存池1.1 池化技术1.2 内存池2、内存池的作用2.1 效率问题2.2 内存碎片3、内存池技术的演进二、简易内存池原理1、整体设计1.1 内存池结构...

2021-08-09

C与汇编混合编程的实现示例

目录1. C语言内联汇编2. C语言调用汇编函数3. 汇编代码调用C语言函数上一期中,使用链表的方式进行对不同任务的调用,实现的效果还是不错的,但是,任务在进行过程中不能进行来回的...

2021-08-09

C++实现LeetCode(25.每k个一组翻转链表)

[LeetCode] 25. Reverse Nodes in k-Group 每k个一组翻转链表Given a linked list, reverse the nodes of a linked list k at a time and return its modified l...

2021-08-09

C++实现LeetCode(28.实现strStr()函数)

[LeetCode] 28. Implement strStr() 实现strStr()函数Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if nee...

2021-08-09

C++实现LeetCode(84.直方图中最大的矩形)

[LeetCode] 84. Largest Rectangle in Histogram 直方图中最大的矩形Given n non-negative integers representing the histogram's bar height where the width...

2021-08-09

C++中单调栈的基本性质介绍

单调栈的定义:单调栈就是栈内元素单调递增或者单调递减的栈,单调栈只能在栈顶操作。为了更好的理解单调栈,则可将单调栈用生活情形模拟实现,例如:我们借用拿号排队的场景来说明下...

2021-08-09

C++实现LeetCode(55.跳跃游戏)

[LeetCode] 55. Jump Game 跳跃游戏Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array...

2021-08-09

C++实现LeetCode(14.最长共同前缀)

[LeetCode] 14. Longest Common Prefix 最长共同前缀Write a function to find the longest common prefix string amongst an array of strings.If there is no common pre...

2021-08-09

C++实现LeetCode(18.四数之和)

[LeetCode] 18. 4Sum 四数之和Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadrup...

2021-08-09

C++实现LeetCode(19.移除链表倒数第N个节点)

[LeetCode] 19. Remove Nth Node From End of List 移除链表倒数第N个节点Given a linked list, remove the nth node from the end of list and return its head.For examp...

2021-08-09

C++实现LeetCode(21.混合插入有序链表)

[LeetCode] 21. Merge Two Sorted Lists 混合插入有序链表Merge two sorted linked lists and return it as a new list. The new list should be made by splicing togethe...

2021-08-09

C++实现LeetCode(24.成对交换节点)

[LeetCode] 24. Swap Nodes in Pairs 成对交换节点Given a linked list, swap every two adjacent nodes and return its head.You may not modify the valu...

2021-08-09

C++实现LeetCode(26.有序数组中去除重复项)

[LeetCode] 26. Remove Duplicates from Sorted Array 有序数组中去除重复项Given a sorted array nums, remove the duplicates in-place such that each e...

2021-08-09

C++实现LeetCode(29.两数相除)

[LeetCode] 29. Divide Two Integers 两数相除Given two integers dividend and divisor, divide two integers without using multiplication, division an...

2021-08-09

C++ 实现桶排序的示例代码

目录原理实现步骤:模拟生成整数随机数桶排序实现完整版可运行程序时间复杂度计算桶排序:整数 原理原理简述:按照需要排序数组的实际情况,生成一个一定长度的一维数组,用于统计需...

2021-08-09

LeetCode 单调栈内容小结

LeetCode Monotone Stack Summary 单调栈小结所谓的单调栈 Monotone Stack,就是栈内元素都是单调递增或者单调递减的,有时候需要严格的单调递增或递减,根据题目的具体情况来看...

2021-08-09

C++实现LeetCode(768.可排序的最大块数之二)

[LeetCode] 768.Max Chunks To Make Sorted II 可排序的最大块数之二This question is the same as "Max Chunks to Make Sorted" except the integers of the given array...

2021-08-09

C++实现LeetCode(12.整数转化成罗马数字)

[LeetCode] 12. Integer to Roman 整数转化成罗马数字Roman numerals are represented by seven different symbols: I, V, X, L, C, D&#160...

2021-08-09

C++实现LeetCode(16.最近三数之和)

[LeetCode] 16. 3Sum Closest 最近三数之和Given an array nums of n integers and an integer target, find three integers in nums ...

2021-08-09

C++学习进阶之Makefile基础用法详解

目录1. Makefile基本语法与执行
2. Makefile简化过程
3. Makefile生成并使用库
3.1 动态库的建立与使用
3.2 动态加载库的建立与使用总结1. Makefile基本语法与执行
为什么...

2021-08-09

VS2019开发Linux C++程序的实现步骤

一级目录第一步, 先将自己的Linux 系统设为静态IP,具体操作如下:1.修改/etc/network/interfaces 地址配置文件,如下所示:
(注 查看ip命令: ip addr 查看网关命令: ip route sh...

2021-08-09

C++实现LeetCode(83.移除有序链表中的重复项)

[LeetCode] 83. Remove Duplicates from Sorted List 移除有序链表中的重复项Given a sorted linked list, delete all duplicates such that each element appear only&#16...

2021-08-09
返回顶部
顶部