搜索结果
查询Tags标签: nullptr,共有 96条记录-
leetcode基础知识C++ nullptr 与 NULL关系
在编写C程序的时候只看到过NULL,而在C++的编程中,我们可以看到NULL和nullptr两种关键字,其实nullptr是C++11版本中新加入的,它的出现是为了解决NULL表示空指针在C++中具有二义性的问题,为了弄明白这个问题,我查找了一些资料,总结如下。 一、C程序中的NULL 在C语言中…
2022/2/5 11:13:13 人评论 次浏览 -
力扣剑指offer第17天 树
47)二叉树剪枝 class Solution { public:TreeNode* pruneTree(TreeNode* root) {if(root->left) root->left = pruneTree(root->left);if(root->right) root->right = pruneTree(root->right);if(root->left==nullptr && root->right==n…
2022/2/4 23:22:32 人评论 次浏览 -
104. 二叉树的最大深度(c++)
/*** Definition for a binary tree node.* struct TreeNode {* int val;* TreeNode *left;* TreeNode *right;* TreeNode() : val(0), left(nullptr), right(nullptr) {}* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}* TreeNod…
2022/2/2 22:16:36 人评论 次浏览 -
使用 FormatMessage 格式化 Windows 错误码.md
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-formatmessage#include <string>#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif // !WIN32_LEAN_AND_MEAN #include <Windows.h>std::string str_win_err(int err)…
2022/1/26 7:04:14 人评论 次浏览 -
【leetcode】1022. Sum of Root To Leaf Binary Numbers
ou are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit.For example, if the path is 0 -> 1 -> 1 -> 0 -> 1, then this could represen…
2022/1/11 23:34:10 人评论 次浏览 -
【leetcode】1022. Sum of Root To Leaf Binary Numbers
ou are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit.For example, if the path is 0 -> 1 -> 1 -> 0 -> 1, then this could represen…
2022/1/11 23:34:10 人评论 次浏览 -
C++设计模式之单例模式
C++设计模式之单例模式(Singleton) 1、序论 在软件系统中,经常有这样一些特殊的类,必须保证它在系统中只存在一个实例,才能保证它们的逻辑正确、以及良好的效率 如何绕过常规的构造器,提供一种机制来保证一个类只有一个单例对象? 有人说可以提醒用户只构建一…
2022/1/9 22:33:28 人评论 次浏览 -
C++设计模式之单例模式
C++设计模式之单例模式(Singleton) 1、序论 在软件系统中,经常有这样一些特殊的类,必须保证它在系统中只存在一个实例,才能保证它们的逻辑正确、以及良好的效率 如何绕过常规的构造器,提供一种机制来保证一个类只有一个单例对象? 有人说可以提醒用户只构建一…
2022/1/9 22:33:28 人评论 次浏览 -
【Leetcode】NO.226 翻转二叉树(C++&Python)[二叉树]
题目 226. 翻转二叉树 思路 递归方法; 对于每一次使用交换左右节点之后进行递归遍历; 代码 递归方法: /*** Definition for a binary tree node.* struct TreeNode {* int val;* TreeNode *left;* TreeNode *right;* TreeNode() : val(0), left(nullpt…
2022/1/6 9:08:18 人评论 次浏览 -
【Leetcode】NO.226 翻转二叉树(C++&Python)[二叉树]
题目 226. 翻转二叉树 思路 递归方法; 对于每一次使用交换左右节点之后进行递归遍历; 代码 递归方法: /*** Definition for a binary tree node.* struct TreeNode {* int val;* TreeNode *left;* TreeNode *right;* TreeNode() : val(0), left(nullpt…
2022/1/6 9:08:18 人评论 次浏览 -
【音视频】windows视音频设备热插拔集成(5-2)
上一篇实现了windows的音视频设备热插拔功能,这一篇集成到SDK中。我的对外接口类是HCMDesktopRecorder,该篇主要讲如何集成热插拔功能,其他代码忽略。 1、开启并注册热插拔 int HCMDesktopRecorder::init(/* 忽略 */) {/* 忽略 */// Create thread for detect device c…
2022/1/4 7:07:48 人评论 次浏览 -
【音视频】windows视音频设备热插拔集成(5-2)
上一篇实现了windows的音视频设备热插拔功能,这一篇集成到SDK中。我的对外接口类是HCMDesktopRecorder,该篇主要讲如何集成热插拔功能,其他代码忽略。 1、开启并注册热插拔 int HCMDesktopRecorder::init(/* 忽略 */) {/* 忽略 */// Create thread for detect device c…
2022/1/4 7:07:48 人评论 次浏览 -
C++反转链表
#include <iostream> using namespace std; struct my_list{int val;my_list* next;my_list(int _val):val(_val),next(nullptr){} }; my_list* reverse_list(my_list* head) {if(head==nullptr) return head;//为空的情况 my_list* pre=head; my_list* tmp=nul…
2021/12/29 22:07:10 人评论 次浏览 -
C++反转链表
#include <iostream> using namespace std; struct my_list{int val;my_list* next;my_list(int _val):val(_val),next(nullptr){} }; my_list* reverse_list(my_list* head) {if(head==nullptr) return head;//为空的情况 my_list* pre=head; my_list* tmp=nul…
2021/12/29 22:07:10 人评论 次浏览 -
翻转二叉树(c++&&golang)
#include <bits/stdc++.h> using namespace std;struct TreeNode {int val;TreeNode *left;TreeNode *right;TreeNode() : val(0), left(nullptr), right(nullptr) {}TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}TreeNode(int x, TreeNode *left, T…
2021/12/28 17:09:58 人评论 次浏览