LeetCode 刷题笔记 (树)

1.  minimum-depth-of-binary-tree

题目描述

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
求二叉树的最小深度;

解题思路

递归遍历二叉树的每一个节点:

(1)如果该节点为null,返回深度为0;

(2)如果节点不为空,返回左,右孩子中较小的那个孩子的深度+1;

注意:在(2)中容易出现的问题是,如果一个节点只有左孩子,没有右孩子,那么此时返回的应该是左孩子的深度,而不应该简单的认为返回两者的最小值;

1 public class Solution {
2     public int run(TreeNode root) {
3         if(root==null)
4             return 0;
5         int right = run(root.right);
6         int left = run(root.left);
7         return (left==0 || right==0)? (left+right+1) : Math.min(left,right)+1; 
8     }
9 }

 

2. binary-tree-postorder-traversal

题目描述

Given a binary tree, return the postorder traversal of its nodes' values. 后序遍历二叉树

For example:
Given binary tree{1,#,2,3},

   1\2/3

return[3,2,1].

Note: Recursive solution is trivial, could you do it iteratively?

解题思路:

后序遍历的顺序是:左->右->根,递归的方法很好写:

 1 public class Solution {
 2     ArrayList<Integer> list = new ArrayList<Integer>();
 3     public ArrayList<Integer> postorderTraversal(TreeNode root) {
 4         if(root==null)
 5             return list;
 6         if(root.left!=null)
 7             postorderTraversal(root.left);
 8         if(root.right!=null)
 9             postorderTraversal(root.right);
10         list.add(root.val);
11         return list;
12     }
13 }

非递归方法,使用栈来迭代:

要保证根结点在左孩子和右孩子访问之后才能访问,因此对于任一结点P,先将其入栈。
(1)如果P不存在左孩子和右孩子,则可以直接访问它;
(2)或者P存在孩子,但是其孩子都已被访问过了,则同样可以直接访问该结点
(3)若非上述两种情况,则将P的右孩子和左孩子依次入栈,这样就保证了
注意:每次取栈顶元素的时候,左孩子在右孩子前面被访问,左孩子和右孩子都在根结点前面被访问。
 1 public class Solution {
 2     public ArrayList<Integer> postorderTraversal(TreeNode root) {
 3         ArrayList<Integer> list = new ArrayList<Integer>();
 4         if(root==null)
 5             return list;
 6         Stack<TreeNode> S = new Stack<TreeNode>();
 7         TreeNode preNode = null;
 8         S.push(root);
 9         while(!S.isEmpty()){
10             TreeNode curNode = S.peek();
11             if((curNode.left==null && curNode.right==null)||
12                (preNode != null && (preNode == curNode.left || preNode == curNode.right))){
13                 list.add(curNode.val);
14                 S.pop();
15                 preNode = curNode;
16             }
17             else{
18                 if(curNode.right!=null)
19                     S.push(curNode.right);
20                 if(curNode.left!=null)
21                     S.push(curNode.left);
22             }
23         }
24         return list;
25     }
26 }

 

3. binary-tree-preorder-traversal

题目描述

Given a binary tree, return the preorder traversal of its nodes' values. 非递归前序遍历二叉树

For example:
Given binary tree{1,#,2,3},

   1\2/3 

return[1,2,3].

Note: Recursive solution is trivial, could you do it iteratively?

解题思路:

利用栈的结构,先序遍历的顺序为 根左右,根先进栈,每次从栈中弹出一个节点访问,并把它的孩子(不为空)按先右后左的顺序入栈,直到栈为空;
 1 public class Solution {
 2     public ArrayList<Integer> preorderTraversal(TreeNode root) {
 3         Stack<TreeNode> S = new Stack<TreeNode>();
 4         ArrayList<Integer> list = new ArrayList<Integer>();
 5         if(root==null){
 6             return list;
 7         }
 8         S.push(root);
 9         while(!S.isEmpty()){
10             TreeNode tmp = S.pop();
11             list.add(tmp.val);
12             if(tmp.right!=null)
13                 S.push(tmp.right);
14             if(tmp.left!=null)
15                 S.push(tmp.left);
16         }
17         return list;
18     }
19 }

 

4. sum-root-to-leaf-numbers

题目描述

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.

An example is the root-to-leaf path1->2->3which represents the number123.

Find the total sum of all root-to-leaf numbers.

For example,

    1/ \2   3

The root-to-leaf path1->2represents the number12.
The root-to-leaf path1->3represents the number13.

Return the sum = 12 + 13 =25.

从根节点到二叉树的叶子节点的每一条路径都有可以用一个数字表示,求这些数字的和;

解题思路:

递归来做,主要就是考虑递归条件和结束条件。递归条件即是把当前的sum乘以10并且加上当前节点传入下一函数,进行递归,最终把左右子树的总和相加。结束条件的话就是如果一个节点是叶子,那么我们应该累加到结果总和中,如果节点到了空节点,则不是叶子节点,不需要加入到结果中,直接返回0即可。本质是一次先序遍历

 1 public class Solution {
 2     public int sumNumbers(TreeNode root) {
 3         return Count(root, 0 );
 4     }
 5     static int Count(TreeNode root,int sum){
 6         if(root==null)
 7             return 0;
 8         if(root.left==null&&root.right==null)
 9             return sum*10+root.val;
10         return Count(root.left,sum*10+root.val)+Count(root.right,sum*10+root.val);
11     }
12 }

5. binary-tree-maximum-path-sum

题目描述

Given a binary tree, find the maximum path sum.

The path may start and end at any node in the tree.

For example:
Given the below binary tree,

       1/ \2   3

Return 6.

 找到二叉树中和最大的一条路径(任意节点为起点,不是根节点,不重复,不相交)

解题思路:

从根节点出发,递归地去找每个节点的左右子树的最大和的路径,返回当前节点的值+左右子树中和较大的那个;

注意,遍历每一条可能的路径时,都要更新最大和是否小于当前这条路径的和,是则更新;

 1 public class Solution {
 2     public int sum = Integer.MIN_VALUE;
 3     public int maxPathSum(TreeNode root) {
 4         if(root==null)
 5             return 0;
 6         max(root);
 7         return sum;
 8     }
 9     public int max(TreeNode root){
10         if(root==null)
11             return 0;
12         int left = Math.max(0, max(root.left));
13         int right = Math.max(0, max(root.right));
14         sum = Math.max(sum, left+right+root.val);
15         return Math.max(left, right)+root.val;
16     }
17 }

 6. populating-next-right-pointers-in-each-node

题目描述

Given a binary tree

    struct TreeLinkNode {TreeLinkNode *left;TreeLinkNode *right;TreeLinkNode *next;}

Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set toNULL.

Initially, all next pointers are set toNULL.

Note:

  • You may only use constant extra space.
  • You may assume that it is a perfect binary tree (ie, all leaves are at the same level, and every parent has two children).

For example,
Given the following perfect binary tree,

         1/  \2    3/ \  / \4  5  6  7

After calling your function, the tree should look like:

         1 -> NULL/  \2 -> 3 -> NULL/ \  / \4->5->6->7 -> NULL

解题思路

由于是完全二叉树,所以每一个节点如果有左孩子,一定有右孩子,所以左孩子的next指向右孩子,
右孩子的next指向其父节点next的左孩子(如果父节点不为空),如果父节点的next为空,则他也指向空;
所以,如果我们知道每一层最左边的节点,那么就可以获得下一层的第一个节点以及下一层所有节点的父节点;
 1 public class Solution {
 2     public void connect(TreeLinkNode root) {
 3         if(root==null)
 4             return;
 5         root.next = null;
 6         TreeLinkNode node = root, next = node;
 7         while(node.left!=null){
 8             next = node;
 9             while(next!=null){
10                 next.left.next = next.right;
11                 if(next.next!=null)
12                     next.right.next = next.next.left;
13                 next = next.next;
14             }
15             node = node.left;
16         }
17     }
18 }

7. populating-next-right-pointers-in-each-node-ii

题目描述

Follow up for problem "Populating Next Right Pointers in Each Node".

What if the given tree could be any binary tree? Would your previous solution still work?

Note:

  • You may only use constant extra space.

For example,
Given the following binary tree,

         1/  \2    3/ \    \4   5    7

After calling your function, the tree should look like:

         1 -> NULL/  \2 -> 3 -> NULL/ \    \4-> 5 -> 7 -> NULL

题目描述

与上题不同,给定的二叉树不一定是完全二叉树;
采用递归的方法,对于每一层,dummy指向每一层的第一个节点,对该层的每一个节点,处理它的孩子的next指向:
如果它有左孩子,那么prev的next就为当前节点的左孩子,并标记左孩子为prev;
如果它有右孩子,那么prev的next就为当前节点的右孩子,并标记右孩子为prev;
这样,无论是否是完全二叉树,都能实现next的正确指向。
 1 public class Solution {
 2     public void connect(TreeLinkNode root) {
 3         if(root == null)
 4             return;
 5         TreeLinkNode dummy = new TreeLinkNode(-1);
 6         TreeLinkNode cur;
 7         TreeLinkNode prev = dummy;
 8         for(cur=root; cur !=null; cur = cur.next){
 9             if(cur.left !=null)
10             {
11                 prev.next = cur.left;
12                 prev = prev.next;
13             }
14             if(cur.right !=null){
15                 prev.next = cur.right;
16                 prev = prev.next;
17             }
18         }
19         connect(dummy.next);
20     }
21 }

8. path-sum

题目描述

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.

For example:
Given the below binary tree andsum = 22,
              5/ \4   8/   / \11  13  4/  \      \7    2      1

return true, as there exist a root-to-leaf path5->4->11->2which sum is 22.

 解题思路

采用递归的思想:如果当前节点是叶子节点,且该节点的val等于sum,则返回true;

否则,递归第去判断该节点的左子树或者右子树的和是否满足sum-val。

1 public class Solution {
2     public boolean hasPathSum(TreeNode root, int sum) {
3         if(root==null)
4             return false;
5         if(root.left==null && root.right==null && root.val==sum)
6             return true;
7         return hasPathSum(root.left,sum-root.val) || hasPathSum(root.right,sum-root.val);
8     }
9 }

9. path-sum-ii

题目描述

Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.

For example:
Given the below binary tree andsum = 22,
              5/ \4   8/   / \11  13  4/  \    / \7    2  5   1

return

[[5,4,11,2],[5,8,4,5]
]
找到路径和为sum的所有路径

 解题思路

判断方法和上一题一样,关键是路径的存储

 1 public class Solution {
 2     public ArrayList<ArrayList<Integer>> pathSum(TreeNode root, int sum) {
 3         ArrayList<ArrayList<Integer>> list = new ArrayList<ArrayList<Integer>>();
 4         if(root==null)
 5             return list;
 6         ArrayList<Integer> ls = new ArrayList<Integer>();
 7         find(list,ls,root,sum);
 8         return list;
 9     }
10     static void find(ArrayList<ArrayList<Integer>> list, ArrayList<Integer> ls, TreeNode root, int sum){
11         if(root==null)
12             return;
13         ls.add(root.val);
14         if(root.left==null && root.right==null && root.val==sum){
15             list.add(ls);
16         }
17         find(list,new ArrayList<Integer>(ls),root.left, sum-root.val);
18         find(list,new ArrayList<Integer>(ls),root.right, sum-root.val);
19     }
20 }

10. balanced-binary-tree

Given a binary tree, determine if it is height-balanced.

For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.

解题思路

递归地判断每颗子树是否为高度平衡二叉树(任一节点的左右子树高度差不超过1)

 1 public class Solution {
 2     public boolean isBalanced(TreeNode root) {
 3         if(root==null)
 4             return true;
 5         if(Math.abs(getDepth(root.left)-getDepth(root.right))>1)
 6             return false;
 7         return (isBalanced(root.left) && isBalanced(root.right));
 8     }
 9     public int getDepth(TreeNode root){
10         if(root==null)
11             return 0;
12         return 1+Math.max(getDepth(root.left),getDepth(root.right));
13     }
14 }

 

 11. binary-tree-level-order-traversal

题目描述

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).

For example:
Given binary tree{3,9,20,#,#,15,7},

    3/ \9  20/  \15   7

return its level order traversal as:

[[3],[9,20],[15,7]
]

 解题思路

二叉树的层次遍历,用广度优先搜索,采用队列实现

 1 import java.util.*;
 2 public class Solution {
 3     public ArrayList<ArrayList<Integer>> levelOrder(TreeNode root) {
 4         ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>();
 5         if(root == null){
 6             return res;
 7         }
 8         Queue<TreeNode> queue = new LinkedList<TreeNode>();
 9         queue.offer(root);
10         while(!queue.isEmpty()){
11             ArrayList<Integer> arr = new ArrayList<Integer>();
12             int size = queue.size();
13             TreeNode p = queue.peek();
14             for(int i=0;i<size;i++){
15                 if(queue.peek().left!=null)
16                     queue.offer(queue.peek().left);
17                 if(queue.peek().right!=null)
18                     queue.offer(queue.peek().right);
19                 arr.add(queue.poll().val);
20             }
21             res.add(arr);
22         }
23         return res;
24     }
25 }

12. binary-tree-level-order-traversal-ii

解题思路

  与上题类似,只不过每层的数据按从底向上输出,仍然按照上题的方法遍历二叉树,但是每层的结果保存在一个栈中,最后按出栈顺序保存在list里;

 1 import java.util.*;
 2 public class Solution {
 3     public ArrayList<ArrayList<Integer>> levelOrderBottom(TreeNode root) {
 4         ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>();
 5         Stack<ArrayList<Integer>> stack = new Stack<ArrayList<Integer>>();
 6         if(root==null)
 7             return res;
 8         Queue<TreeNode> queue = new LinkedList<TreeNode>();
 9         queue.offer(root);
10         while(!queue.isEmpty()){
11             ArrayList<Integer> arr = new ArrayList<Integer>();
12             int size = queue.size();
13             for(int i=0;i<size;i++){
14                 if(queue.peek().left!=null)
15                     queue.offer(queue.peek().left);
16                 if(queue.peek().right!=null)
17                     queue.offer(queue.peek().right);
18                 arr.add(queue.poll().val);
19             }
20             stack.push(arr);
21         }
22         while(!stack.isEmpty()){
23             res.add(stack.pop());
24         }
25         return res;
26     }
27 }

13. binary-tree-zigzag-level-order-traversal

解题思路

Z字形层次遍历二叉树

与上题类似,添加一个标志,如果是偶数层,反转该层的元素即可

 1 import java.util.*;2 public class Solution {3     public ArrayList<ArrayList<Integer>> zigzagLevelOrder(TreeNode root) {4         ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>();5         if(root == null){6             return res; 7  } 8 Queue<TreeNode> queue = new LinkedList<TreeNode>(); 9  queue.offer(root); 10 boolean reserve = true; 11 while(!queue.isEmpty()){ 12 reserve = !reserve; 13 ArrayList<Integer> arr = new ArrayList<Integer>(); 14 int size = queue.size(); 15 TreeNode p = queue.peek(); 16 for(int i=0;i<size;i++){ 17 if(queue.peek().left!=null) 18  queue.offer(queue.peek().left); 19 if(queue.peek().right!=null) 20  queue.offer(queue.peek().right); 21  arr.add(queue.poll().val); 22  } 23 if(reserve){ 24 int len = arr.size(); 25 int t = len/2; 26 for(int i=0;i<t;i++){ 27 Collections.swap(arr,i,len-1-i); 28  } 29  } 30  res.add(arr); 31  } 32 return res; 33  } 34 }

14. maximum-depth-of-binary-tree

解题思路

  求二叉树的最大深度

  递归求左右子树的最大深度,每个节点的最大深度为左右子树的最大深度+1(自身)

1 public class Solution {
2     public int maxDepth(TreeNode root) {
3         return root == null ? 0 : (1 + Math.max(maxDepth(root.left), maxDepth(root.right)));
4     }
5 }

15. symmetric-tree

给定一棵二叉树,判断其是否为对称的二叉树

解题思路

  递归判断左右子树是否完全相同即可

 1 public class Solution {
 2     public boolean isSymmetric(TreeNode root) {
 3         if(root==null)
 4             return true;
 5         return judge(root.left,root.right);
 6     }
 7     private static boolean judge(TreeNode a,TreeNode b){
 8         if(b==null && a==null)
 9             return true;
10         else if((a==null && b!=null) || (a!=null && b==null))
11             return false;
12         else
13             return (a.val==b.val && judge(a.left,b.right) && judge(a.right,b.left));
14     }
15 }

16. same-tree

判断两棵树是否完全相同

解题思路

  递归判断两个数的左子树是否完全相同且右子树完全相同

1 public class Solution {
2     public boolean isSameTree(TreeNode p, TreeNode q) {
3         if(p==null && q==null)
4             return true;
5         if( (p==null && q!=null) || (p!=null && q==null))
6             return false;
7         return (p.val==q.val && isSameTree(p.left,q.left) && isSameTree(p.right,q.right));
8     }
9 }

 

 

 

 



转载于:https://www.cnblogs.com/PJQOOO/p/10978662.html

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

综述 | 北斗系统应用趋势分析

来源&#xff1a;智绘科服初审&#xff1a;张艳玲复审&#xff1a;宋启凡终审&#xff1a;金 君一、前言2020年6月23日&#xff0c;北斗三号最后一颗组网卫星成功发射。2020年7月31日&#xff0c;北斗三号建成暨开通仪式举行&#xff0c;北斗三号全球卫星导航系统正式开通[1]…

数据结构与算法——贪心算法

文章目录1.分发饼干1.1 题目描述1.2 解题思路1.3 C实现2.摆动序列2.1 题目描述2.2 解题思路2.3 C实现3.移掉K位数字3.1 题目描述3.2 解题思路3.3 C实现4.跳跃游戏4.1 题目描述4.2 解题思路4.3 C实现5.跳跃游戏 II5.1 题目描述5.2 解题思路5.3 C实现6.用最少数量的箭引爆气球6.1…

人为什么要睡觉?科学家给出进一步答案

来源&#xff1a;科技日报作者&#xff1a;张佳欣 人类一生中有三分之一的时间在睡觉&#xff0c;包括苍蝇、蠕虫甚至水母等无脊椎动物也会睡觉。在整个进化过程中&#xff0c;睡眠对所有具有神经系统的有机体来说都是普遍的&#xff0c;也是必不可少的。然而你有没有想过&…

自我觉察-3:发现-我这么做究竟为了什么?

今天一个人在食堂吃饭时&#xff0c;不是很饿&#xff0c;又拿了很多菜&#xff0c;就挑挑拣拣的吃&#xff0c;然后呢&#xff0c;又觉得吃相不雅&#xff0c;让别人看了不好。就有点儿端着架子吃似的。这时候&#xff0c;我突然想起一句话“我用自认为优雅地姿势吃饭为了什么…

操作系统——简介

文章目录1.操作系统的功能和目标1.1 作为用户和计算机硬件之间的接口1.2 作为系统资源的管理者1.3 作为最接近硬件的层次2.操作系统的概念、功能和目标3.操作系统的四大特征3.1 并发3.2 共享3.3 虚拟3.4 异步4.操作系统的运行机制4.1 两种指令4.2 两种处理器状态4.3 两种程序5.…

Andrew Gelman、Aki Vehtari​ | 过去50年最重要的统计学思想是什么?

来源&#xff1a; 数据分析网作者 &#xff1a;Andrew Gelman 美国统计学家、哥伦比亚大学统计学教授Aki Vehtari 阿尔托大学计算机科学系副教授近日&#xff0c;图灵奖得主、“贝叶斯网络之父”Judea Pearl在Twitter上分享了一篇新论文“What are the most important statis…

全局唯一ID的生成

数据在分片时&#xff0c;典型的是分库分表&#xff0c;就有一个全局ID生成的问题。单纯的生成全局ID并不是什么难题&#xff0c;但是生成的ID通常要满足分片的一些要求&#xff1a; 1 不能有单点故障。 2 以时间为序&#xff0c;或者ID里包含时间。这样一是可以少一个索引…

操作系统——进程

文章目录1.进程的定义2.进程的组成3.PCB4.进程的状态4.1 进程的五种状态4.2 进程状态间的转换5.进程控制6.进程通信6.1 共享存储6.2 管道通信6.3 消息传递7.线程7.1 线程的概念7.2 引入线程后的变化7.3 线程的属性7.4 线程的实现方式7.4.1 用户级线程7.4.2 内核级线程7.4.3 混合…

10分钟了解图卷积神经网络的常用算法和发展方向

来源&#xff1a;数学算法俱乐部近几年&#xff0c;机器学习在各个领域井喷式发展&#xff0c;现已成为当下最热门的技术。掌握机器学习&#xff0c;你就比 80% 的人更具备竞争优势。谷歌的无人驾驶、抖音的推荐系统、百度的人脸识别、大疆的无人机、科大讯飞的语音识别、小米的…

python学习之数据类型(int,bool,str)

第三章 数据类型 3.1 Python基本数据类型 类型含义描述int整数主要用来进⾏数学运算str字符串可以保存少量数据并进⾏相应的操作bool布尔值判断真假&#xff0c;True&#xff0c;Falselist列表存储⼤量数据&#xff0c;⽤[ ]表示tuple元组不可以发⽣改变 用( )表示dict字典保存…

操作系统——调度

文章目录1.调度的概念2.调度的三个层次2.1 高级调度2.2 中级调度2.3 低级调度2.4 三种调度之间的关联1.调度的概念 2.调度的三个层次 2.1 高级调度 2.2 中级调度 2.3 低级调度 2.4 三种调度之间的关联

诺奖得主被曝40多篇论文造假!

来源&#xff1a;科研城邦截止2021年11月6日&#xff0c;Gregg L. Semenza教授针对其在Pubpeer被挂的52篇论文&#xff0c;进行了至少6篇文章的纠正&#xff0c;且撤回了1篇文章。离谱的是&#xff0c;这位美国约翰霍普金斯大学教授&#xff0c;正是2019年诺贝尔生理学或医学奖…

操作系统——死锁

文章目录1.死锁的概念2.死锁产生的必要条件3.什么时候会发生死锁4.死锁的处理策略4.1 预防死锁4.1.1 破坏互斥条件4.1.2 破坏不剥夺条件4.1.3 破坏请求和保持条件4.1.4 破坏循环等待条件4.2 避免死锁4.2.1 安全序列4.2.2 银行家算法1.死锁的概念 2.死锁产生的必要条件 3.什么时…

苏联的三进制电脑,为什么被二进制干掉了?

来源&#xff1a;差评 当我们在电脑上打开一个软件&#xff0c;看一部电影&#xff0c;听一首歌的时候&#xff0c;我们很难想象&#xff0c;这些东西都是由 0 和 1 这样的二进制数字组成的。但你有没有好奇过&#xff1f;为什么计算机要用二进制呢&#xff1f;难道是因为它效…

动态规划-背包问题

0-1背包 N件物品&#xff0c;背包最大容量为V, 第i件物品的费用为w[i],价值为v[i] 使用f[i][j]表示在容量为j&#xff0c;在前i件物品中(包括i)选择物品所获得的最大价值 递推方程为f[i][j] max(f[i-1][j], f[i-1][j - w[i]] v[i]) 在是否选择第i件物品取最大值 从后往前更新…

linux标准I/O——标准I/O介绍

文章目录1.文件的相关概念1.1 什么是文件1.2 文件类型2.标准I/O概念2.1 什么是标准I/O2.2 FILE和流2.3 流的缓冲类型2.4 stdin&#xff0c;stdout和stderr1.文件的相关概念 1.1 什么是文件 \qquad一组相关数据的有序集合 1.2 文件类型 文件类型表示举例常规文件r文本文件、二…

70页论文,图灵奖得主Yoshua Bengio一作:「生成流网络」拓展深度学习领域

来源&#xff1a;机器学习研究组订阅GFlowNet 会成为新的深度学习技术吗&#xff1f;近日&#xff0c;一篇名为《GFlowNet Foundations》的论文引发了人们的关注&#xff0c;这是一篇图灵奖得主 Yoshua Bengio 一作的新研究&#xff0c;论文长达 70 页。在 Geoffrey Hinton 的「…

linux标准I/O——流的打开和关闭

文章目录1.打开流2.mode参数3.fopen举例4.新建文件权限5.处理错误信息6.关闭流1.打开流 2.mode参数 3.fopen举例 #include<stdio.h> int main() {FILE *fp;fpfopen("a.txt","r");if(fpNULL){printf("fopen error\n");return -1;}return 0…

卷积神经网络数学原理解析

来源&#xff1a;海豚数据科学实验室作 者&#xff1a;Piotr Skalski翻 译&#xff1a;通夜&#xff08;中山大学&#xff09;、had_in&#xff08;电子科技大学&#xff09;编 辑&#xff1a;Pita 原标题&#xff1a;Gentle Dive into Math Behind Convolutional Neural N…

【大数据】分布式集群部署

1、集群规划部署 节点名称NN1NN2DN RMNMhadoop01NameNode DataNode NodeManagerhadoop02 SecondaryNameNodeDataNodeResourceManagerNodeManagerhadoop03 DataNode NodeManager2、参考单机部署&#xff0c;拷贝安装目录至相同目录&#xff0c;使用ln -s 建立软连接 3、修改配置…