二叉树(4)------收尾

1)最大二叉树

654. 最大二叉树 - 力扣(LeetCode)

题目解析:

1)首先我们找到了整个数组中最大的元素作为我们的根节点,然后再从左区间中找到最大的元素作为当前根节点的左子树,然后再从右区间里面找到最大的元素作为根节点的右子树

2)本题中使用前序遍历的方式来构建一棵二叉树,像这种构建一颗二叉树的题目都是必须先进行遍历出根节点,然后再进行构建右树或者是左树

class Solution {
    public TreeNode createTree(int[] nums,int left,int right){
        if(left>right) return null;
        int maxIndex=left;
        int maxData=nums[left];
        for(int i=left+1;i<=right;i++){
            if(nums[i]>maxData){
                maxData=nums[i];
                maxIndex=i;
            }
        }
    TreeNode root=new TreeNode(maxData);
    root.left=createTree(nums,left,maxIndex-1);
    root.right=createTree(nums,maxIndex+1,right);
    return root;
    }
    public TreeNode constructMaximumBinaryTree(int[] nums) {
        return createTree(nums,0,nums.length-1);
    }
}

2)二叉树迭代器

​​​​ 173. 二叉搜索树迭代器 - 力扣(LeetCode)

思路1:我们可以将二叉搜索树做一次完全的中序遍历,获取中序遍历的结果并存放到数组中,随后我们可以利用数组本身来实现迭代器

class BSTIterator {
    private int index=-1;
    private List<Integer> result;
    public void dfs(TreeNode root){
        if(root==null) return;
        dfs(root.left);
        result.add(root.val);
        dfs(root.right);
    }
    public BSTIterator(TreeNode root) {
        result=new ArrayList<>();
        index=0;//记录当前遍历到哪一个位置
        dfs(root);
    }
    
    public int next() {
         return result.get(index++);
    }
    
    public boolean hasNext() {
         return index<result.size();
    }
}

思路2:除了递归的方法之外,我们还可以使用迭代的方式针对于整棵二叉树做中序遍历,但是我们无需对这棵二叉树做一个完整的中序遍历,只需要维护栈的情况即可

class BSTIterator {
    Stack<TreeNode> stack=new Stack<>();
    TreeNode current=null;
    public BSTIterator(TreeNode root) {
        this.current=root;
    }
    public int next() {
        while(current!=null){
            stack.push(current);
            current=current.left;
        }
    TreeNode node=stack.pop();
    current=node.right;
    return node.val;
    }
    
    public boolean hasNext() {
        return !stack.isEmpty()||current!=null;
    }
}

3)合并二叉树

解法1:深度优先遍历

同时遍历两颗二叉树的根节点左节点和右节点

class Solution {
    public TreeNode mergeTrees(TreeNode root1, TreeNode root2) {
        if(root1==null) return root2;
        if(root2==null) return root1;
        TreeNode root=new TreeNode(root1.val+root2.val);
        root.left=mergeTrees(root1.left,root2.left);
        root.right=mergeTrees(root1.right,root2.right);
       return root;
    }
}

解法2:宽度优先遍历:

在这里面我们使用的是三个队列,第一个队列存放的是第一个二叉树的左右节点,第二个队列存放的是第二个二叉树的左右节点,第三个队列存放的是合并完之后的节点充当根节点;

class Solution {
    public TreeNode mergeTrees(TreeNode root1, TreeNode root2) {
        if(root1==null) return root2;
        if(root2==null) return root1;
        Queue<TreeNode> queue1=new LinkedList<>();
        Queue<TreeNode> queue2=new LinkedList<>();
        Queue<TreeNode> queue=new LinkedList<>();
        queue1.add(root1);
        queue2.add(root2);
        TreeNode rootNode=new TreeNode(root1.val+root2.val);
        queue.add(rootNode);
        while(!queue1.isEmpty()&&!queue2.isEmpty()){
            TreeNode root=queue.poll();
            TreeNode node1=queue1.poll();
            TreeNode node2=queue2.poll();
            TreeNode left1=node1.left;
            TreeNode right1=node1.right;
            TreeNode left2=node2.left;
            TreeNode right2=node2.right;
            if(left1!=null||left2!=null){
                if(left1!=null&&left2!=null){
                  TreeNode left=new TreeNode(left1.val+left2.val);
                  root.left=left;
                  queue.add(left);
                  queue1.add(left1);
                  queue2.add(left2);
                }else if(left1!=null){
                    root.left=left1;
                }else if(left2!=null){
                    root.left=left2;
                }
            }
            if(right1!=null||right2!=null){
                System.out.println(11);
                if(right1!=null&&right2!=null){
                    TreeNode right=new TreeNode(right1.val+right2.val);
                    root.right=right;
                    queue.add(right);
                    queue1.add(right1);
                    queue2.add(right2);
                }else if(right1!=null){
                    root.right=right1;
                }else if(right2!=null){
                    root.right=right2;
                }
            }
        }
    return rootNode;
    }
}

4)二叉树的最大路径和

124. 二叉树中的最大路径和 - 力扣(LeetCode)

算法原理:本体还是使用后序遍历的方式来做的,因为进行计算二叉树的最大路径和,针对于每一个节点来说,都是采取这样的方式来进行计算的:

1)递推公式:当前节点的路径和=当前的结点的值+左节点向上最大路径+右节点向上路径和

2)而左右节点又是拥有着自己的路径和,而这些路径和又有可能是最大的路径和

3)节点向上最大路径:当前节点+Math.max(左子树的最大路径,右子树的最大路径)

在这里面dfs函数被赋予的任务就是得到一个根节点的向上返回的最大路径

4)相当于是说我们在求出从一个节点到叶子节点的最大路径和的过程中就更新了最终想要的结果

class Solution {
    //返回经过root的单边分支最大和,即Math.max(root, root+left, root+right)
    int max=Integer.MIN_VALUE;
    public int dfs(TreeNode root){
         if(root==null) return 0;
    //计算左边分支最大值,左边分支如果为负数还不如不选择
        int left=Math.max(dfs(root.left),0);
//计算右边分支最大值,右边分支如果为负数还不如不选择,left->root->right 作为路径与已经计算过历史最大值做比较
        int right=Math.max(dfs(root.right),0);
    //更新最终结果
       max=Math.max(left+root.val+right,max);
    //返回经过root的单边最大分支给当前root的父节点计算使用
        return root.val+Math.max(left,right);
    }
    public int maxPathSum(TreeNode root) {
        dfs(root);
        return max;
    }
}

5)验证二叉树的前序序列化

331. 验证二叉树的前序序列化 - 力扣(LeetCode)

解法1:将所有的#当作是一个叶子节点,所有的非#字符当成一个非叶子节点,那么最终要满足的条件就是度是0的叶子节点=度是2的节点+1

在没有针对于整个二叉树做先序遍历之前,叶子结点的数量一定是小于等于非叶子节点的数量的

class Solution {
    public boolean isValidSerialization(String str) {
        int leafCount=0;
        int nodeCount=0;
        String[] string=str.split(",");
        for(String s:string){
            if(leafCount>nodeCount) return false;
            if(s.equals(",")) continue;
            else if(s.equals("#")) leafCount++;
            else nodeCount++;
        }
    return nodeCount+1==leafCount;
    }
}
class Solution {
    public boolean isValidSerialization(String str) {
        int leafCount=0;
        int nodeCount=0;
        String[] strings=str.split(",");
        for(int i=strings.length-1;i>=0;i--){
            if(strings[i].equals("#")) leafCount++;
            else{
                if(leafCount>=2) leafCount--;
                else return false;
            }
        }
    return leafCount==1;
    }
}

6)二叉搜索树中的众数:

采用左中右中序遍历的方式来解决这道问题

class Solution {
    List<Integer> list=new ArrayList<>();
    int prev=Integer.MIN_VALUE;
    int count=0;
    int maxCount=-1;
    public void dfs(TreeNode root){
        if(root==null) return;
        dfs(root.left);
//更新count值
        if(prev==Integer.MIN_VALUE){
            count=1;
        }else if(prev==root.val){
            count++;
        }else count=1;
//更新最终结果
        if(count==maxCount) list.add(root.val);
        else if(count>maxCount){
            list.clear();
            list.add(root.val);
            maxCount=count;  
        }
//修改指针指向
        prev=root.val;
        dfs(root.right);
    }
    public int[] findMode(TreeNode root) {
         dfs(root);
         int[] nums=new int[list.size()];
         System.out.println(list);
         int i=0;
         for(int num:list){
             nums[i]=num;
             i++;
         }
     return nums;
    }
}
class Solution {
    public int MaxCount=Integer.MIN_VALUE;
    public int prev=Integer.MAX_VALUE;
    HashMap<Integer,Integer> map=new HashMap<>();
    public int count=0;
    public void dfs(TreeNode root){
        if(root==null) return;
        dfs(root.left);
        if(root.val==prev){
            count++;
        }else{
            count=1;
        }
      if(count>=MaxCount){
            MaxCount=count;
            map.put(root.val,MaxCount);
        }
        prev=root.val;
        dfs(root.right);
    }
    public int[] findMode(TreeNode root) {
        if(root.left==null&&root.right==null) return new int[]{root.val};
        dfs(root);
        List<Integer> list=new ArrayList<>();
         for(Map.Entry<Integer,Integer> entry:map.entrySet()){
             if(entry.getValue()==MaxCount){
                    list.add(entry.getKey());
             }  
        }
        int[] result=new int[list.size()];
        int index=0;
        for(int num:list){
            result[index]=num;
            index++;
        }
    return result;
    }
}
控制台

7)二叉搜索树的最近公共祖先:

1)如果是单纯的针对于二叉树来说,最近公共祖先就是我们在左子树中进行寻找有没有出现过p或者是q,然后如果左子树中有,那么就直接返回根节点,然后再从右子树中进行寻找p或者是q,如果右子树中也没有,那么直接返回null,有的话直接返回根节点,只要左子树或者是右子树出现了p或者是q就像向上返回,当然这也是我们的重复子问题;

2)针对于这个题来说,本质上还是使用后序遍历的的方式来进行处理,因为左右根,我们可以在根节点拿到左右子树的信息,从而进行整合,然后最后将根节点向上返回

class Solution {
    public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
        if(root==null) return null;
        else if(p.val<root.val&&q.val>root.val) return root;
        else if(p.val>root.val&&q.val<root.val) return root;
        else if(p==root) return p;
        else if(q==root) return q;
        else{
            TreeNode root1=lowestCommonAncestor(root.left,p,q);
            TreeNode root2=lowestCommonAncestor(root.right,p,q);
            if(root1==null&&root2==null){
                return null;
            }else if(root1!=null&&root2==null){
                return root1;
            }else if(root1!=null&&root2!=null){
                return root;
            }else{
                return root2;
            }
        }
    }
}
class Solution {
    public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
        if(root==null) return root;
        if(p.val==root.val||q.val==root.val) return root;
        if(p.val<root.val&&q.val<root.val){
            TreeNode left=lowestCommonAncestor(root.left,p,q);
            System.out.println(left.val);
            if(left!=null) return left;
        }else if(p.val>root.val&&q.val>root.val){
            TreeNode right=lowestCommonAncestor(root.right,p,q);
            if(right!=null) return right;
        }
    return root;
    }
}

非递归代码:利用二叉搜索树的特性

class Solution {
    public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
        if(root==null) return null;
        while(root!=null){
            if(root.val>p.val&&root.val>q.val){
                root=root.left;
            }else if(root.val<p.val&&root.val<q.val){
                root=root.right;
            }else{
                return root;
            }
        }
    return null;
    }
}

8)路经总和:

目标是遍历到叶子结点的时候进行收集结果

class Solution {
    List<Boolean> list=new ArrayList<>();
    int sum=0;
    int targetSum=0;
    List<Integer> path=new ArrayList<>();
    public void dfs(TreeNode root){
        if(root==null) return;
        if(root.left==null&&root.right==null){
            sum+=root.val;
            if(sum==targetSum){
                list.add(true);
            }else{
                list.add(false);
            }
        sum-=root.val;
        return;
        }
    if(root.left!=null){
         path.add(root.val);
         sum+=root.val;
         dfs(root.left);
         sum-=root.val;
         path.remove(path.size()-1);
    }
    if(root.right!=null){
            path.add(root.val);
            sum+=root.val;
            dfs(root.right);
            sum-=root.val;
            path.remove(path.size()-1);
        }
    }
    public boolean hasPathSum(TreeNode root, int targetSum) {
        this.targetSum=targetSum;
        dfs(root);
        System.out.println(list);
        for(boolean flag:list){
            if(flag==true) return true;
        }
    return false;
    }
}

解法2:还是回溯+递归:

1)目的是当我们进行深度优先遍历的时候,遇到一个结点的时候就让sum-root.val就做一次减法,如果遇到叶子节点,况且此时我们的sum值被减为0了,说明沿着路径的节点进行相加和等于目标值

2)递归的结束出口也是我们收集结果的的一个出口:

class Solution {
    public boolean dfs(TreeNode root,int targetSum){
        if(root==null) return false;
        if(root.left==null&&root.right==null){
            targetSum=targetSum-root.val;
            if(targetSum==0) return true;
            else return false;//说明这个路径不是我所想要的路径
        }
        boolean flag1=false,flag2=false;
//将左子树是否出现了等于目标和的路径返回给根节点
if(root.left!=null)  flag1=dfs(root.left,targetSum-root.val);//回溯的过程做隐藏了
//将右子树是否出现了等于目标和的路径返回给根节点,回溯的过程体现在递归函数的下面
if(root.right!=null)  flag2=dfs(root.right,targetSum-root.val);
//向上一层进行返回
 return flag1||flag2;
    }
    public boolean hasPathSum(TreeNode root, int targetSum) {
        return dfs(root,targetSum);
    }
}

9)二叉树的最大直径 

算法原理:

1)首先求出一个根节点的左子树的深度,在求出右子树的深度

2)此时以当前根节点为二叉树的直径就是左子树的深度+右子树的深度

3)相当于是说在求出二叉树的高度的时候就可以直接更新结果了

543. 二叉树的直径 - 力扣(LeetCode)

class Solution {
    int max=0;
    public int getHeight(TreeNode root){
        if(root==null) return 0;
        if(root.left==null&&root.right==null) return 1;
        int leftHeight=getHeight(root.left);
        int rightHeight=getHeight(root.right);
//更新结果
        max=Math.max(max,leftHeight+rightHeight);
//返回树的高度
        return Math.max(leftHeight,rightHeight)+1;
    }
    public int diameterOfBinaryTree(TreeNode root) {
        getHeight(root);
        return max;
    }
}

10)二叉树的坡度:

563. 二叉树的坡度 - 力扣(LeetCode)

算法原理:二叉树的坡度就是左子树的节点之和和右子树的节点之和的差的绝对值

这道算法题是在递归的过程中在不断的进行更新结果值,其实本质上dfs被赋予的任务就是计算出每一个节点的左右子树之和+当前根节点之和

lass Solution {
    int sum=0;
    public int dfs(TreeNode root){
        if(root==null) return 0;
        int left=dfs(root.left);
        int right=dfs(root.right);
        sum=sum+Math.abs(left-right);
        return left+right+root.val;
    }
    public int findTilt(TreeNode root) {
        dfs(root);
        return sum;
    }
}

11)在二叉树中增加一行

 623. 在二叉树中增加一行 - 力扣(LeetCode)

解法1:深度优先遍历:直接从根节点向下进行深度优先遍历,深度++,当遍历到对应的深度的时候直接向下添加节点即可,但是下面这种写法有问题

 

class Solution {
    public int insertDepth;
    public TreeNode addOneRow(TreeNode root, int val, int depth) {
        this.insertDepth=depth;
    //特殊处理要插入的位置是第一层
        if(depth==1){
            TreeNode node=new TreeNode(val);
            node.left=root;
            return node;
        }
       dfs(root,val,1);
       return root;
    }
    public void dfs(TreeNode root,int val,int depth){
        if(root==null) return;
        if(depth==insertDepth-1){
            TreeNode left=root.left;
            TreeNode right=root.right;
            root.left=new TreeNode(val);
            root.right=new TreeNode(val);
            root.left.left=left;
            root.right.right=right;
            return;
        }
        dfs(root.left,val,depth+1);
        dfs(root.right,val,depth+1);
    }
}

解法2:宽度优先遍历:

class Solution {
    public TreeNode addOneRow(TreeNode root, int val, int depth) {
        Queue<TreeNode> queue=new LinkedList<>();
        int insertDepth=1;
        queue.add(root);
        List<TreeNode> list=new ArrayList<>();
        list.add(root);
//特殊处理要插入的位置是第一层
        if(depth==1){
            TreeNode node=new TreeNode(val);
            node.left=root;
            return node;
        }
//这个for循环的目的是将depth-1层的节点全部添加到list中
        for(int i=1;i<depth-1;i++){
            List<TreeNode> temp=new ArrayList<>();
            for(TreeNode node:list){
                if(node.left!=null) temp.add(node.left);
                if(node.right!=null) temp.add(node.right);
            }
            list=temp;
        }
    for(TreeNode node:list){
            TreeNode left=node.left;
            TreeNode right=node.right;
            node.left=new TreeNode(val);
            node.right=new TreeNode(val);
            node.left.left=left;
            node.right.right=right;
      }
    return root;
    }
}

12)二叉树的锯齿形层序遍历:

 103. 二叉树的锯齿形层序遍历 - 力扣(LeetCode)

层序遍历+双端队列+双向链表(可以进行头插,也可以进行尾插)

class Solution {
    public List<List<Integer>> zigzagLevelOrder(TreeNode root) {
        List<List<Integer>> ret=new ArrayList<>();
        Queue<TreeNode> queue=new LinkedList<>();
        queue.add(root);
         if(root==null) return ret;
        while(!queue.isEmpty()){
            LinkedList<Integer> temp=new LinkedList<>();
            int size=queue.size();
            for(int i=0;i<size;i++){
               TreeNode node=queue.poll();
               if(ret.size()%2==0){
                   temp.addLast(node.val);
               }else{
                   temp.addFirst(node.val);
               }
             if (node.left!= null) queue.add(node.left);
             if (node.right!= null) queue.add(node.right);
            }
        ret.add(temp);
        }
    return ret;
    }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/68463.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

SpringBoot笔记:SpringBoot 集成 Dataway 多数据源配置(二)

文章目录 前言核心代码和配置yml 配置注入多数据源常用Spi实现swagger 配置自定义 Udf指定数据源进行查询 前言 之前简单介绍了一下 Dataway 使用&#xff0c;本文继续介绍一下它的多数据源配置和使用。 核心代码和配置 yml 配置 # springboot多环境配置 #端口&#xff0c;…

企业服务器器中了360后缀勒索病毒怎么解决,勒索病毒解密数据恢复

随着网络威胁的增加&#xff0c;企业服务器成为黑客攻击的目标之一。近期&#xff0c;上海某知名律师事务所的数据库遭到了360后缀的勒索病毒攻击&#xff0c;导致企业服务器内的数据库被360后缀勒索病毒加密。许多重要的数据被锁定无法正常读取&#xff0c;严重影响了企业的正…

【Mybatis】调试查看执行的 SQL 语句

1. 问题场景&#xff1a; 记录日常开发过程中 Mybatis 调试 SQL 语句&#xff0c;想要查看Mybatis 中执行的 SQL语句&#xff0c;导致定位问题困难 2. 解决方式 双击shift找到mybatis源码中的 MappedStatement的getBoundSql()方法 public BoundSql getBoundSql(Object para…

Stable Diffusion - 人物坐姿 (Sitting) 的提示词组合 与 LoRA 和 Embeddings 配置

欢迎关注我的CSDN&#xff1a;https://spike.blog.csdn.net/ 本文地址&#xff1a;https://spike.blog.csdn.net/article/details/132201960 拍摄人物坐姿时&#xff0c;需要注意&#xff1a; 选择一个舒适和自然的坐姿&#xff0c;符合个性和心情。可以坐在椅子、沙发、长凳、…

手机app测试

一、安装、卸载、更新、运行 1.安装、卸载 应用是否可以正常安装&#xff08;命令行安装&#xff1b;apk&#xff0f;ipa安装包安装&#xff09;&#xff08;有网&#xff0c;无网是否都正常&#xff09;卸载过程中出现死机&#xff0c;断电&#xff0c;重启等意外的情况&…

Wisej.NET Crack,Wisej.NET的核心功能

Wisej.NET Crack&#xff0c;Wisej.NET的核心功能 Wisej.NET是一个跨平台的web框架&#xff0c;用于使用.NET和C#/VB.NET而不是HTML和JavaScript构建现代HTML5应用程序。它包含创建任务关键型web应用程序所需的一切&#xff0c;包括UI组件、会话处理、状态管理和后端集成。借助…

仿到位|独立版家政上门预约服务小程序家政保洁师傅上门服务小程序上门服务在线派单源码

上门预约服务派单小程序家政 小程序 同城预约 开源代码 独立版. 程序完整,经过安装检测,可放心下载安装。 适合本地的一款上门预约服务小程序,功能丰富,适用多种场景。 程序功能:城市管理/小程序DIY/服务订单/师傅管理/会员卡功能/营销功能/文章功能等等

vmwera中安装的centos8出现ifconfig不可用

刚刚在虚拟机中装好centos结果发现自己的ifconfig命令不可用。 看一下环境变量里有没有ifconfig命令的路径&#xff0c;因为ifconfig是在/sbin路径下的&#xff0c;root用户登录进去才可以运行&#xff0c;先看一下root用户的环境变量。 root用户的环境变量里是有/sbin路径的&a…

javaScript:分支语句的理解与使用(附带案例)

目录 前言 补充 另一种说法 分支语句 1.if语句 a.单分支语句 注意 b.双分支语句 注意点 c.多分支语句&#xff08;分支语句的联级语句&#xff09; 补充 2.三元运算符 三元运算符 &#xff1f; &#xff1a; 使用场景 3.switch语句 解释 释义&#xff1a…

将本地项目上传至gitee的详细步骤

将本地项目上传至gitee的详细步骤 1.在gitee上创建以自己项目名称命名的空项目2.进入想上传的项目的文件夹&#xff0c;然后右键点击3. 初始化本地环境&#xff0c;把该项目变成可被git管理的仓库4.添加该项目下的所有文件5.使用如下命令将文件添加到仓库中去6.将本地代码库与远…

最小生成树—Kruskal算法

什么是最小生成树&#xff1f; 首先&#xff0c;最小生成树一定数无向图&#xff0c;并且在不影响所有点都连通的情况下&#xff0c;所有边的权重加起来最小值是多少。 比如说&#xff1a;无向图abcp如下图所示&#xff0c;每条边权重也标记出来了。最小生成树就如右侧所示。 …

ModaHub魔搭社区——Milvus Cloud向量数据库

向量数据库:在AI时代的快速发展与应用 摘要: 随着人工智能技术的不断进步,向量数据库在处理大规模数据方面发挥着越来越重要的作用。本文介绍了向量数据库的基本概念、应用场景和技术挑战,并详细阐述了Milvus Cloud作为典型的向量数据库产品的技术特点、性能优化和应用案例…

yolov5的报错

【定期水一期】 &#xff08;这个问题很抓马&#xff0c;可以看一下这篇文章&#xff1a;Git Bash 教程&#xff01;【不是所有人都会用Git】&#xff09; 一&#xff1a;没有cv2这个模块 解决方案&#xff1a; pip install opencv-python -i http://pypi.douban.com/simple/…

内网穿透实战应用-配置固定的远程桌面地址【内网穿透、无需公网IP】

配置固定的远程桌面地址【内网穿透、无需公网IP】 文章目录 配置固定的远程桌面地址【内网穿透、无需公网IP】第一步&#xff1a;保留TCP地址第二步&#xff1a;为远程桌面隧道配置固定的TCP地址第三步&#xff1a;使用固定TCP地址远程桌面 使用免费的cpolar生成的远程桌面公网…

【计算机组成原理】24王道考研笔记——第三章 存储系统

第三章 存储系统 一、存储系统概述 现代计算机的结构&#xff1a; 1.存储器的层次结构 2.存储器的分类 按层次&#xff1a; 按介质&#xff1a; 按存储方式&#xff1a; 按信息的可更改性&#xff1a; 按信息的可保存性&#xff1a; 3.存储器的性能指标 二、主存储器 1.基本…

STM32 F103C8T6学习笔记3:串口配置—串口收发—自定义Printf函数

今日学习使用STM32 C8T6的串口&#xff0c;我们在经过学习笔记2的总结归纳可知&#xff0c;STM32 C8T6最小系统板上有三路串口&#xff0c;如下图&#xff1a; 今日我们就着手学习如何配置开通这些串口进行收发&#xff0c;这里不讲串口通信概念与基础&#xff0c;可以自行网上…

连续两年增收不增利,比亚迪电子靠新能源汽车业务再次起飞?

在净利润连续两年下挫之后&#xff0c;比亚迪电子&#xff08;00285.HK&#xff09;终于迎来了好消息。 不久前比亚迪电子发布2023年中期盈利预告显示&#xff0c;上半年净利润同比增加115%-146%&#xff08;2022年上半年的净利润显示6.34亿元&#xff09;。 这主要受益于大客…

vue+springboot基于web的火车高铁铁路订票管理系统

铁路订票管理系统按照权限的类型进行划分&#xff0c;分为用户和管理员两个模块。管理员模块主要针对整个系统的管理进行设计&#xff0c;提高了管理的效率和标准。主要功能包括个人中心、用户管理、火车类型管理、火车信息管理、车票预订管理、车票退票管理、系统管理等&#…

【Rust】Rust学习 第八章常见集合

Rust 标准库中包含一系列被称为 集合&#xff08;collections&#xff09;的非常有用的数据结构。大部分其他数据类型都代表一个特定的值&#xff0c;不过集合可以包含多个值。不同于内建的数组和元组类型&#xff0c;这些集合指向的数据是储存在堆上的&#xff0c;这意味着数据…

Spring Initailizr--快速入门--SpringBoot的选择

&#x1f600;前言 本篇博文是关于IDEA使用Spring Initializer快速创建Spring Boot项目的说明&#xff0c;希望能够帮助到您&#x1f60a; &#x1f3e0;个人主页&#xff1a;晨犀主页 &#x1f9d1;个人简介&#xff1a;大家好&#xff0c;我是晨犀&#xff0c;希望我的文章可…