Giter Club home page Giter Club logo

treenode's Introduction

TreeNode

用于leetcode刷题的二叉树工具类

tools目录下放的是一些依赖类

test.java是测试程序,可以参考其中的用法

TreeNode

TreeNode就是二叉树的节点类,内置命令行打印输出(使用重写toString,直接打印节点即可,参见测试程序)

TreeUtils

TreeUtils是二叉树的工具类

mkTree: 可将leetcode测试用例的字符串直接转化为二叉树

mkTreeFull: 是mkTree的旧版本,只能转化完全二叉树的字符串(也就是说null需要全部打出,哪怕是null的子节点也需要打印出null)

saveImage:将二叉树保存成png图片,存放于项目的根目录(懒得写了),传入的二叉树可以是字符串形式, 也可以是TreeNode形式,同时需要传入文件名(不带扩展名)

showImage: 将二叉树通过java原生打印输出,传入参数参考saveImage

treenode's People

Contributors

momentderek avatar

Stargazers

masx200 avatar

Watchers

James Cloos avatar  avatar

treenode's Issues

有bug

当我输入是 [1,null,10,12,13,4,6,null,15,null,null,5,11,null,2,14,7,null,8,null,null,null,9,3]这个报数组越界。
TreeNode treeNode = TreeUtils.mkTree("[1,null,10,12,13,4,6,null,15,null,null,5,11,null,2,14,7,null,8,null,null,null,9,3]");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.