当前位置: 首页 > news >正文

C++笔试-剑指offer

剑指offer

文章目录

  • 剑指offer
    • 数组
      • [数组中重复的数据 ](https://leetcode.cn/problems/find-all-duplicates-in-an-array/description/)
        • 将元素交换到对应的位置
      • 二维数组中的查找
        • 二叉搜索树
      • 旋转数组的最小数字
        • 二分查找
      • 数组中出现次数超过一半的数字
        • 相互抵消
      • 连续子数组的最大和(二)
        • 动态规划
    • 链表
      • 从尾到头打印链表
        • 反转链表(双指针、递归)
        • 拓展:反转链表中间一部分
      • 删除链表的节点
      • 链表合并
      • 链表中倒数最后k个结点
        • 双指针思想
      • 复杂链表的复制
        • 哈希表
        • 在每个旧节点后加上新节点
      • 删除有序链表中重复的元素-I
        • 双指针思想
      • 删除链表中重复的结点
    • 二叉树
      • 二叉树的深度
        • 递归
      • 二叉树的最小深度
      • 二叉树的镜像
    • 队列、栈
      • 用两个栈实现队列
    • 动态规划
    • 跳台阶
        • DP(ACM模式)
        • 递归(ACM模式)

数组

数组中重复的数据

将元素交换到对应的位置
class Solution {
public:vector<int> findDuplicates(vector<int>& nums) {vector<int> result;for (int i = 0; i<nums.size();i++){while (nums[i] != nums[nums[i]-1]){swap(nums[i],nums[nums[i]-1]);}}for (int i = 0; i<nums.size();i++){if (nums[i]-1 != i){result.push_back(nums[i]);}}return result;}
};

时间复杂度O(n)

空间复杂度O(1)

二维数组中的查找

二叉搜索树
class Solution{
public:bool Find(int target, vector<vector><int> arr){if (arr.empty() || arr[0].empty()) return false;int i = 0;//行int j = arr.size()-1;//列while (i<=arr.size()-1 && j>=0){if (target == arr[i][j])return true;else if (tartget < arr[i][j])--j;else++i;}return false;}
}

类似于二叉搜索树:

1

旋转数组的最小数字

二分查找

最小值一定在右区域!

class Solution {
public:/*** 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可** * @param nums int整型vector * @return int整型*/int minNumberInRotateArray(vector<int>& nums) {int left = 0, right = nums.size()-1;int mid;while (left<right){mid = (left + right)/2;if (nums[left]<nums[right])//left一定在左区域或最低点,right一定在右区域,左区域的数一定大于等于右区域的数return nums[left];if (nums[mid] > nums[right])//mid在左区域,最小的数字在mid右边{left = mid + 1;}else if (nums[mid] == nums[right])//mid在重复元素{--right;}else //mid在右区域, 最小数字要么是mid要么在mid左边{right = mid;}}return nums[left];}
};

数组中出现次数超过一半的数字

相互抵消

用不同数字相互抵消的方法,最后留下来的一定是超过一半的数字

    int MoreThanHalfNum_Solution(vector<int>& numbers) {// write code hereint num = numbers[0];int count = 1;for (int i = 1; i<numbers.size(); ++i){if (count > 0){if (numbers[i]==num){++count;}else {--count;}}else //count = 0{num = numbers[i];count = 1;}}return num;}
};

1287. 有序数组中出现次数超过25%的元素

由于这题是升序,可以直接用步长判断,也可以用上题的步骤判断

连续子数组的最大和(二)

根据剑指offer自己想的,待优化:

int最大值INT_MAX,最小值INT_MIN

int的最小值可以写成0x8000000,最大值可以写成0x7FFFFFFF

class Solution {
public:vector<int> FindGreatestSumOfSubArray(vector<int>& arr) {// write code hereint result = 0x80000000;vector<int> vresult;vector<int> temp;int sum = 0;for (int i =0;i<arr.size();++i){if (sum<0)//如果和为负数,那么前一个和一定是从那个元素开始算的最大和了{temp.clear();temp.push_back(arr[i]);sum=arr[i];}else {sum+=arr[i];temp.push_back(arr[i]);}if (sum>=result){result = sum;vresult = temp;}}return vresult;}
};
动态规划
//只需要保存最大值时:
int res = nums[0];
for (int i = 1; i < nums.size(); i++) {if (nums[i - 1] > 0) nums[i] += nums[i - 1];if (nums[i] > res) res = nums[i];
}
return res;
//需要保存对应的子数组时:

求连续子数组的最大和(ACM模式)

#include <iostream>
#include <string>
#include <vector>
using namespace std;int main() {string str;cin>>str;//输入是个字符串int k =0;vector<int> numbers;while((k = str.find(',')) != str.npos){//注意输出的方法string temp = str.substr(0, k);numbers.push_back(stoi(temp));str = str.substr(k + 1);}numbers.push_back(stoi(str));int tempmax = 0;int result = 0x80000000;int sum = 0;for (int i =0; i<numbers.size();++i){if (sum<0){sum=numbers[i];}else {sum+=numbers[i];}result = max(sum,result);}if (result<0){result = 0;}printf("%d",result);
}
// 64 位输出请用 printf("%lld")

链表

从尾到头打印链表

利用栈先入后出的特点,很好解决

class Solution {
public:vector<int> printListFromTailToHead(ListNode* head) {stack<int> stk;vector<int> result;int value = 0;while (head!=nullptr){stk.push(head->val);head = head->next;}while (!stk.empty()){value = stk.top();result.push_back(value);stk.pop();}return result;}
};

时间复杂度O(n)

空间复杂度O(n)

反转链表(双指针、递归)

双指针:

class Solution {
public:vector<int> printListFromTailToHead(ListNode* head) {ListNode* preNode = nullptr;ListNode* curNode = head;while(curNode!=nullptr){ListNode* temp = curNode->next;curNode->next = preNode;preNode = curNode;curNode = temp;}vector<int> result;while(preNode!=nullptr){result.push_back(preNode->val);preNode = preNode->next;}return result;}
};

时间复杂度O(n)

空间复杂度O(1)

递归

class Solution {
public:vector<int> printListFromTailToHead(ListNode* head) {ListNode* newhead = ReverseList(head);vector<int> result;while (newhead!=nullptr){result.push_back(newhead->val);newhead = newhead->next;}return result;}ListNode* ReverseList(ListNode* head){if (head==nullptr || head->next==nullptr){return head;}ListNode* newhead = ReverseList(head->next);head->next->next = head;head->next = nullptr;return newhead;}
};

时间复杂度O(n)

空间复杂度O(n)

拓展:反转链表中间一部分

92. 反转链表 II - 力扣(LeetCode)

class Solution {
public:ListNode* reverseBetween(ListNode* head, int left, int right) {if (head->next==nullptr || left==right){return head;}ListNode* dummyhead = new ListNode(0);dummyhead->next = head;ListNode* preleftEdge = dummyhead;ListNode* leftEdge = head;ListNode* rightEdge = head;for(int i = 1; i<left;++i){preleftEdge = preleftEdge->next;leftEdge = preleftEdge->next;}for(int i = 1; i<right;++i){rightEdge = rightEdge->next;}ListNode* nextrightEdge = rightEdge->next;ListNode* leftNode = leftEdge;ListNode* firstNode = leftNode;ListNode* rightNode = leftNode->next;while (rightNode!=nextrightEdge){ListNode* temp = rightNode->next;rightNode->next = leftNode;leftNode = rightNode;rightNode = temp;}preleftEdge->next = leftNode;firstNode->next = nextrightEdge;return dummyhead->next;}
};

删除链表的节点

class Solution {
public:/*** 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可** * @param head ListNode类 * @param val int整型 * @return ListNode类*/ListNode* deleteNode(ListNode* head, int val) {// write code hereListNode* dummyhead = new ListNode(0);dummyhead->next = head;ListNode* pre = dummyhead;ListNode* cur = head;while (cur!=nullptr){if (cur->val==val){pre->next = cur->next;break;}else {cur = cur->next;pre = pre->next;}}return dummyhead->next;}
};

还有一种不需要知道前驱结点就可以“删除”链表结点的方法,前提是不能删除最后一个结点:

class Solution {
public:void deleteNode(ListNode* node) {node->val = node->next->val;node->next = node->next->next;}
};

链表合并

ACM模式的话要注意输入输出,然后要注意cur指针的更新

#include <iostream>
using namespace std;
struct ListNode
{int val;ListNode* next;ListNode(int val): val(val), next(nullptr){}
};int main() {int a;ListNode* dummyhead = new ListNode(0);ListNode* cur = dummyhead;ListNode* dummyhead1 = new ListNode(0);ListNode* cur1 = dummyhead1;ListNode* dummyhead2 = new ListNode(0);ListNode* cur2 = dummyhead2;while(cin>>a){ListNode* node = new ListNode(a);cur1->next = node;cur1 = cur1->next;if(cin.get()=='\n'){break;}}while(cin>>a){ListNode* node = new ListNode(a);cur2->next = node;cur2 = cur2->next;}cur1 = dummyhead1->next;cur2 = dummyhead2->next;while (cur1!=nullptr && cur2!=nullptr){if (cur1->val<=cur2->val){cur->next = cur1;cur1 = cur1->next;}else {cur->next = cur2;cur2 = cur2->next;}cur = cur->next;}if (cur1==nullptr){cur->next = cur2;}if (cur2==nullptr){cur->next = cur1;}cur = dummyhead->next;while (cur!=nullptr){printf("%d ",cur->val);cur = cur->next;}return 0;
}
// 64 位输出请用 printf("%lld")

链表中倒数最后k个结点

双指针思想

右指针指向左指针后k个元素,这样当右指针为最后一个节点后的元素时,左指针指向的就是所求元素

/*** struct ListNode {*	int val;*	struct ListNode *next;*	ListNode(int x) : val(x), next(nullptr) {}* };*/
class Solution {
public:/*** 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可** * @param pHead ListNode类 * @param k int整型 * @return ListNode类*/ListNode* FindKthToTail(ListNode* pHead, int k) {// write code hereif (pHead==nullptr){return nullptr;}ListNode* left = pHead;ListNode* right = left;for (int i =0; i<k;++i){if(right==nullptr){return nullptr;}right = right->next;  }while (right!=nullptr){right = right->next;left = left->next;}return left;}
};

复杂链表的复制

LCR 154. 复杂链表的复制 - 力扣(LeetCode)

哈希表

键为旧指针,值为新指针。第一次遍历时初始化键和值的label,第二次赋上next和random指针

class Solution {
public:Node* copyRandomList(Node* head) {if (head==nullptr){return nullptr;}unordered_map<Node*,Node*> mp;Node* cur = head;while (cur!=nullptr){Node* newNode = new Node(cur->val);mp[cur] = newNode;cur = cur->next;}cur = head;while (cur!=nullptr){mp[cur]->next = mp[cur->next];mp[cur]->random = mp[cur->random];cur = cur->next;}return mp[head];}
};
在每个旧节点后加上新节点

最后要记得把旧链表头结点断开连接

class Solution {
public:RandomListNode* Clone(RandomListNode* pHead) {if (pHead==nullptr){return nullptr;}//初始化nextRandomListNode* cur1 = pHead;while (cur1!=nullptr){RandomListNode* newNode = new RandomListNode(cur1->label);newNode->next = cur1->next;cur1->next = newNode;cur1 = cur1->next->next;}//赋值randomcur1 = pHead;RandomListNode* cur2 = pHead->next;while (cur1!=nullptr){if (cur1->random != nullptr){cur2->random = cur1->random->next;}cur1 = cur1->next->next;cur2 = cur2->next->next;}//拆分链表RandomListNode* newCloneHead = pHead->next;cur2 = newCloneHead;pHead->next = nullptr;while (cur2->next!=nullptr){cur2->next = cur2->next->next;cur2 = cur2->next;}cur2->next=nullptr;cur1 = pHead;cur2 = pHead->next;return newCloneHead;}
};

删除有序链表中重复的元素-I

双指针思想
    ListNode* deleteDuplicates(ListNode* head) {// write code hereif (head==nullptr){return nullptr;}ListNode* dummyhead = new ListNode(0);ListNode* left = dummyhead;ListNode* right = head;while(right!=nullptr){while (right->next!=nullptr && right->val==right->next->val){right = right->next;}left->next = right;left = left->next;right = right->next;}return dummyhead->next;}

删除链表中重复的结点

比前面多了再将right右移一步的动作,以及最后要把left指向nullptr

class Solution {
public:ListNode* deleteDuplication(ListNode* pHead) {if (pHead==nullptr){return nullptr;}ListNode* dummyhead = new ListNode(0);ListNode* left = dummyhead;ListNode* right = pHead;while(right!=nullptr){if(right->next!=nullptr && right->val==right->next->val){while (right->next!=nullptr && right->val==right->next->val){right = right->next;}right = right->next;continue;}left->next = right;left = left->next;right = right->next;}left->next = nullptr;return dummyhead->next;}
};

二叉树

二叉树的深度

递归

返回左子树和右子树深度的最大值加上一(后序遍历)

class Solution {
public:int TreeDepth(TreeNode* pRoot) {if (pRoot==nullptr){return 0;}return max(TreeDepth(pRoot->left),TreeDepth(pRoot->right))+1;}
};

二叉树的最小深度

111. 二叉树的最小深度 - 力扣(LeetCode)

和二叉树的(最大)深度的区别是,计算的是到叶子节点(左右孩子都为空)的最小深度,也用后序遍历实现

class Solution {
public:int minDepth(TreeNode* root) {if (root==nullptr){return 0;}if (root->left==nullptr && root->right!=nullptr){return minDepth(root->right)+1;}else if (root->right==nullptr && root->left!=nullptr){return minDepth(root->left)+1;}else{return min(minDepth(root->left),minDepth(root->right))+1;}}
};

二叉树的镜像

LCR 144. 翻转二叉树 - 力扣(LeetCode)

前序遍历

TreeNode* Mirror(TreeNode* pRoot) {// write code hereif (pRoot==nullptr) return pRoot;swap(pRoot->left,pRoot->right);Mirror(pRoot->left);Mirror(pRoot->right);return pRoot;}

后序遍历

TreeNode* Mirror(TreeNode* pRoot) {// write code hereif (pRoot==nullptr) return pRoot;Mirror(pRoot->left);Mirror(pRoot->right);swap(pRoot->left,pRoot->right);return pRoot;}

队列、栈

用两个栈实现队列

每当要pop的时候就获取stack2的最上面的元素,如果stack2为空,则将stack1依次出栈到stack2。这样stack2上面的就是最先push进去的元素,最底下是最新push进去的元素。

class Solution
{
public:void push(int node) {stack1.push(node);}int pop() {while (!stack2.empty()){int result = stack2.top();stack2.pop();return result;}while (!stack1.empty()){int temp = stack1.top();stack2.push(temp);stack1.pop();}int result = stack2.top();stack2.pop();return result;}private:stack<int> stack1;stack<int> stack2;
};

动态规划

跳台阶

DP(ACM模式)
#include <iostream>
#include <unordered_map>using namespace std;int main() {int a;cin>>a;unordered_map<int,int> dp;dp[0] = 1;dp[1] = 1;dp[2] = 2;if (a<=2){printf("%d",dp[a]);}else {for (int i=3;i<=a;i++){int temp = dp[2];dp[2] +=dp[1];dp[1] = temp;}printf("%d",dp[2]);}return 0;
}
// 64 位输出请用 printf("%lld")
递归(ACM模式)
#include <iostream>
using namespace std;int Jump(int num)
{if (num==0) return 1;if (num==1) return 1;if (num==2) return 2;return Jump(num-1) + Jump(num-2);
}int main() {int a;cin>>a;int result = Jump(a);printf("%d",result);return 0;
}
// 64 位输出请用 printf("%lld")

相关文章:

C++笔试-剑指offer

剑指offer 文章目录 剑指offer数组[数组中重复的数据 ](https://leetcode.cn/problems/find-all-duplicates-in-an-array/description/)将元素交换到对应的位置 二维数组中的查找二叉搜索树 旋转数组的最小数字二分查找 数组中出现次数超过一半的数字相互抵消 连续子数组的最大…...

Mac安装jadx并配置环境

jadx官网&#xff1a;GitHub - skylot/jadx: Dex to Java decompiler 第一种&#xff1a; 安装jadx命令&#xff1a; brew install jadx 启动jadx-gui命令&#xff1a; jadx-gui 可能遇到的问题&#xff1a; Downloading https://formulae.brew.sh/api/formula.jws.json** h…...

前端学习----css基础语法

CSS概述 CAscading Style Sheets(级联样式表) CSS是一种样式语言,用于对HTML文档控制外观,自定义布局等,例如字体,颜色,边距等 可将页面的内容与表现形式分离,页面内容存放在HTML文档中,而用于定义表现形式的CSS在一个.css文件中或HTML文档的某一部分 HTML与CSS的关系 HTM…...

超详解——python条件和循环——小白篇

目录 1. 缩进和悬挂else 2. 条件表达式 3. 和循环搭配的else 4. 可调用对象 总结&#xff1a; 1. 缩进和悬挂else 在Python中&#xff0c;代码块是通过缩进来表示的。条件判断和循环结构的代码块需要正确缩进。悬挂else指的是else子句和相应的if或循环在同一级别的缩进。 …...

DNS协议 | NAT技术 | 代理服务器

目录 一、DNS协议 1、DNS背景 2、DNS协议 域名 域名解析 二、NAT技术 1、NAT技术 2、NAPT技术 3、NAT技术的缺陷 三、代理服务器 1、正向代理服务器 2、反向代理服务器 一、DNS协议 域名系统&#xff08;Domain Name System&#xff0c;缩写&#xff1a;DNS&#…...

深入ES6:解锁 JavaScript 类与继承的高级玩法

个人主页&#xff1a;学习前端的小z 个人专栏&#xff1a;JavaScript 精粹 本专栏旨在分享记录每日学习的前端知识和学习笔记的归纳总结&#xff0c;欢迎大家在评论区交流讨论&#xff01; ES5、ES6介绍 文章目录 &#x1f4af;Class&#x1f35f;1 类的由来&#x1f35f;2 co…...

领域驱动设计:异常处理

一、异常的处理 异常处理是领域模型要考虑的一部分&#xff0c;原因在于模型的责任不可能无限大。在遇到自己处理能力之外的情况时&#xff0c;要采用异常机制报告错误&#xff0c;并将处理权转交。异常就是这样一种机制&#xff0c;某种程度上&#xff0c;它可以保证领域模型…...

网络网络层之(6)ICMPv6协议

网络网络层之(6)ICMPv6协议 Author: Once Day Date: 2024年6月2日 一位热衷于Linux学习和开发的菜鸟&#xff0c;试图谱写一场冒险之旅&#xff0c;也许终点只是一场白日梦… 漫漫长路&#xff0c;有人对你微笑过嘛… 全系列文章可参考专栏: 通信网络技术_Once-Day的博客-CS…...

《大道平渊》· 拾壹 —— 商业一定是个故事:讲好故事,员工奋发,顾客买单。

《大道平渊》 拾壹 "大家都在喝&#xff0c;你喝不喝&#xff1f;" 商业一定是个故事&#xff0c;人民群众需要故事。 比如可口可乐的各种故事。 可口可乐公司也只是被营销大师们&#xff0c; 作为一种故事载体&#xff0c;发挥他们的本领。 营销大师们开发故事…...

JavaScript 如何访问本地文件夹

在浏览器环境中的JavaScript&#xff08;通常指的是前端JavaScript&#xff09;由于安全限制&#xff0c;无法直接访问用户的本地文件或文件夹。这是为了防止恶意脚本访问并窃取用户的敏感数据。 但是&#xff0c;有几种方法可以间接地让用户选择并访问本地文件&#xff1a; 使…...

ArrayList顺序表简单实现

一、创建MyArrayList框架 1.1 MyArrayList 类中实现 arr 数组 import java.util.Arrays;public class MyArrayList {private int[] arr;private int usesize;private static final int P 10;public MyArrayList() {arr new int[P];} 在 MyArrayList 类内创建 arr 数组&…...

144、二叉树的前序递归遍历

题解&#xff1a; 递归书写三要素&#xff1a; 1&#xff09;确定递归函数的参数和返回值。要确定每次递归所要用到的参数以及需要返回的值 2&#xff09;确定终止条件。操作系统也是用栈的方式实现递归&#xff0c;那么如果不写终止条件或者终止条件写的不对&#xff0c;都…...

youtube 1080 分辨率 下载方式

YouTube 1080p Video Downloader 这张图像代表了Autodesk Maya中一个名为rocket_body_MAT的材质的着色器网络。下面是对节点及其连接的细分: 节点 place2dTexture12: 该节点用于控制2D纹理在表面上的位置映射。输出: Out UVrocket_body2.jpg: 该节点代表一个纹理文件,具体是…...

计算机网络ppt和课后题总结(下)

常用端口总结 计算机网络中&#xff0c;端口是TCP/IP协议的一部分&#xff0c;用于标识运行在同一台计算机上的不同服务。端口号是一个16位的数字&#xff0c;范围从0到65535。通常&#xff0c;0到1023的端口被称为“熟知端口”或“系统端口”&#xff0c;它们被保留给一些标准…...

测试基础12:测试用例设计方法-边界值分析

课程大纲 1、定义 经验发现&#xff0c;较多的错误往往发生在输入或输出范围的边界上&#xff0c;因为边界值是代码判断语句的点&#xff0c;一般容易出问题&#xff08;数值写错、多加或丢失等号、写错不等号方向…&#xff09;。所以增加对取值范围的边界数据的测试&#xff…...

AI大模型在健康睡眠监测中的深度融合与实践案例

文章目录 1. 应用方案2. 技术实现2.1 数据采集与预处理2.2 构建与训练模型2.3 个性化建议生成 3. 优化策略4. 应用示例&#xff1a;多模态数据融合与实时监测4.1 数据采集4.2 实时监测与反馈 5. 深入分析模型选择和优化5.1 LSTM模型的优势和优化策略5.2 CNN模型的优势和优化策略…...

【西瓜书】9.聚类

聚类任务是无监督学习的一种用于分类等其他任务的前驱过程&#xff0c;作为数据清洗&#xff0c;基于聚类结果训练分类模型 1.聚类性能度量&#xff08;有效性指标&#xff09; 分类任务的性能度量有错误率、精度、准确率P、召回率R、F1度量(P-R的调和平均)、TPR、FPR、AUC回归…...

使用jemalloc实现信号驱动的程序堆栈信息打印

使用jemalloc实现信号驱动的程序堆栈信息打印 本文介绍应用如何集成jemalloc&#xff0c;在接收到SIGUSR1信号10时打印程序的堆栈信息。 1. 编译jemalloc 首先&#xff0c;确保你已经编译并安装了启用prof功能的jemalloc。以下是ubuntu18.04上的编译步骤&#xff1a; git c…...

树的4种遍历

目录 树的四种遍历方式的总结 1. 前序遍历&#xff08;Pre-order Traversal&#xff09; 2. 中序遍历&#xff08;In-order Traversal&#xff09; 3. 后序遍历&#xff08;Post-order Traversal&#xff09; 4. 层序遍历&#xff08;Level-order Traversal 或 广度优先遍…...

深入探讨5种单例模式

文章目录 一、对比总览详细解释 二、代码1. 饿汉式2. 饱汉式3. 饱汉式-双检锁4. 静态内部类5. 枚举单例 三、性能对比 一、对比总览 以下是不同单例模式实现方式的特性对比表格。表格从线程安全性、延迟加载、实现复杂度、反序列化安全性、防反射攻击性等多个方面进行考量。 …...

浏览器访问 AWS ECS 上部署的 Docker 容器(监听 80 端口)

✅ 一、ECS 服务配置 Dockerfile 确保监听 80 端口 EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]或 EXPOSE 80 CMD ["python3", "-m", "http.server", "80"]任务定义&#xff08;Task Definition&…...

rknn优化教程(二)

文章目录 1. 前述2. 三方库的封装2.1 xrepo中的库2.2 xrepo之外的库2.2.1 opencv2.2.2 rknnrt2.2.3 spdlog 3. rknn_engine库 1. 前述 OK&#xff0c;开始写第二篇的内容了。这篇博客主要能写一下&#xff1a; 如何给一些三方库按照xmake方式进行封装&#xff0c;供调用如何按…...

React hook之useRef

React useRef 详解 useRef 是 React 提供的一个 Hook&#xff0c;用于在函数组件中创建可变的引用对象。它在 React 开发中有多种重要用途&#xff0c;下面我将全面详细地介绍它的特性和用法。 基本概念 1. 创建 ref const refContainer useRef(initialValue);initialValu…...

.Net框架,除了EF还有很多很多......

文章目录 1. 引言2. Dapper2.1 概述与设计原理2.2 核心功能与代码示例基本查询多映射查询存储过程调用 2.3 性能优化原理2.4 适用场景 3. NHibernate3.1 概述与架构设计3.2 映射配置示例Fluent映射XML映射 3.3 查询示例HQL查询Criteria APILINQ提供程序 3.4 高级特性3.5 适用场…...

Qt Widget类解析与代码注释

#include "widget.h" #include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget) {ui->setupUi(this); }Widget::~Widget() {delete ui; }//解释这串代码&#xff0c;写上注释 当然可以&#xff01;这段代码是 Qt …...

C# 类和继承(抽象类)

抽象类 抽象类是指设计为被继承的类。抽象类只能被用作其他类的基类。 不能创建抽象类的实例。抽象类使用abstract修饰符声明。 抽象类可以包含抽象成员或普通的非抽象成员。抽象类的成员可以是抽象成员和普通带 实现的成员的任意组合。抽象类自己可以派生自另一个抽象类。例…...

IoT/HCIP实验-3/LiteOS操作系统内核实验(任务、内存、信号量、CMSIS..)

文章目录 概述HelloWorld 工程C/C配置编译器主配置Makefile脚本烧录器主配置运行结果程序调用栈 任务管理实验实验结果osal 系统适配层osal_task_create 其他实验实验源码内存管理实验互斥锁实验信号量实验 CMISIS接口实验还是得JlINKCMSIS 简介LiteOS->CMSIS任务间消息交互…...

高防服务器能够抵御哪些网络攻击呢?

高防服务器作为一种有着高度防御能力的服务器&#xff0c;可以帮助网站应对分布式拒绝服务攻击&#xff0c;有效识别和清理一些恶意的网络流量&#xff0c;为用户提供安全且稳定的网络环境&#xff0c;那么&#xff0c;高防服务器一般都可以抵御哪些网络攻击呢&#xff1f;下面…...

Maven 概述、安装、配置、仓库、私服详解

目录 1、Maven 概述 1.1 Maven 的定义 1.2 Maven 解决的问题 1.3 Maven 的核心特性与优势 2、Maven 安装 2.1 下载 Maven 2.2 安装配置 Maven 2.3 测试安装 2.4 修改 Maven 本地仓库的默认路径 3、Maven 配置 3.1 配置本地仓库 3.2 配置 JDK 3.3 IDEA 配置本地 Ma…...

AI病理诊断七剑下天山,医疗未来触手可及

一、病理诊断困局&#xff1a;刀尖上的医学艺术 1.1 金标准背后的隐痛 病理诊断被誉为"诊断的诊断"&#xff0c;医生需通过显微镜观察组织切片&#xff0c;在细胞迷宫中捕捉癌变信号。某省病理质控报告显示&#xff0c;基层医院误诊率达12%-15%&#xff0c;专家会诊…...