GithubHelp home page GithubHelp logo

key-algorithms's Introduction

Key-Algorithms

Algorithms 4th edition重点算法,对于刷题,复习,准备面试都有很大帮助。

第1章 基础

1.基础算法

第2章 排序

2.排序算法

第3章 查找

3.查找算法

第4章 图

4.图算法

第5章 字符串

5.字符串算法

[第6章 背景]

6.其余背景算法

新增 无注释 No Comment 版本

无注释版本

无注释版本 可以用来复习。复习时,自己主动给关键部分写注释,再对照原来的注释,看看是否真正理解。

去掉注释使用的批量去注释小软件:

批量去注释-Java

举一个刷题的小例子:

leetcode 104题:找到二叉树最大深度

如果记得 3.3binary search tree里面关于height的code,就可以瞬间写出bug free的solution了。

以下是3.3binary search tree里面关于height的code:

/**
* Returns the height of the BST (for debugging).
*
* @return the height of the BST (a 1-node tree has height 0)
*/
public int height() {
    return height(root);
}
private int height(Node x) {
    if (x == null) return -1;
    return 1 + Math.max(height(x.left), height(x.right));
}



//以下是104题的解法:



/**
* Definition for a binary tree node.
* public class TreeNode {
*     int val;
*     TreeNode left;
*     TreeNode right;
*     TreeNode(int x) { val = x; }
* }
*/
public class Solution {
    public int maxDepth(TreeNode root) {
        if (root == null) return 0;
        return 1 + Math.max(root.left, root.right);
    }
}

key-algorithms's People

Contributors

mxc19912008 avatar

Watchers

James Cloos avatar

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.