![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
没错,我就是程师傅
燃烧我的发际线
展开
-
二叉树遍历——先序遍历、中序遍历、后序遍历(递归+非递归)
二叉树遍历算法其中我把递归遍历算法注释掉了,因为比较容易理解。public class TreeTest { public static void main(String[] args) { Tree tree = initTree();// DLR(tree);// System.out.println("=====");// LDR(tree);// System.out.println("=====");原创 2020-06-22 16:49:18 · 23151 阅读 · 0 评论 -
算法:最大子序列求和问题 (时间复杂度O(N))
问题描述存在队列A1、A2、A3…An,求最大子序列的和public static int max(int[] a) { int maxSum = 0, thisSum = 0; int maxNum = a[0];//主要用来考虑数组为全负数的情况 for (int I = 0; I < a.length; I++) { System.out.println(thisSum); thisSum +=原创 2020-06-09 20:50:47 · 23274 阅读 · 0 评论