# algorithm **Repository Path**: STxlbm/algorithm ## Basic Information - **Project Name**: algorithm - **Description**: 算法 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-01-04 - **Last Updated**: 2023-09-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # -算法题更新 ## 记录 ### 剑指 Offer 55 - I. 二叉树的深度 #### 1月17日 并没有写新的算法题。但是学会了用非递归的方式实现了 先序,中序,后序遍历 ```java public class Trees{ public void pre(Node head){ if(head != null){ Stack stack = new Stack(); stack.add(head); while (!stack.isEmpty()){ head = stack.pop(); System.out.println(head.value + " "); if(head.right != null){ stack.push(head.right); } if(head.left != null){ stack.push(head.left); } } } System.out.println(); } } ``` ##leetcode配置 ```java //CodeFileConfig: $!velocityTool.camelCaseName(${question.titleSlug}) //CodeTemplate: package com.zzj.leetcode; /** * @program: algorithm * @description: * ${question.title} * ${question.frontendQuestionId} ${question.titleSlug} * ${question.content} * @author: Zhang Bo * @create: 2022-01-14 17:05 **/ public class $!velocityTool.camelCaseName(${question.titleSlug}){ public static void main(String[] args) { Solution solution = new $!velocityTool.camelCaseName(${question.titleSlug})().new Solution(); } ${question.code} } /** * @description: $description$ * @param: $param$ * @return: $return$ * @author: $user$ * @date: $date$ */ ``` ## 二叉树 ###基础 * 对于二叉树的先中后序遍历需要很熟练的掌握(做二叉树的基础) * 要尽可能的掌握树的递归和循环两种方式