Giter VIP home page Giter VIP logo

krahets / hello-algo Goto Github PK

View Code? Open in Web Editor NEW
75.4K 75.4K 9.5K 289 MB

《Hello 算法》:动画图解、一键运行的数据结构与算法教程。支持 Python, Java, C++, C, C#, JS, Go, Swift, Rust, Ruby, Kotlin, TS, Dart 代码。简体版和繁体版同步更新,English version ongoing

Home Page: https://hello-algo.com

License: Other

Java 17.58% C++ 16.27% Python 14.40% Go 14.63% JavaScript 14.37% Swift 17.39% CMake 0.76% Dockerfile 0.14% Ruby 4.46%
algo algorithm algorithms book data-structure data-structures data-structures-and-algorithms dsa education leetcode programming

hello-algo's Introduction

hello-algo-typing-svg
动画图解、一键运行的数据结构与算法教程

简体中文 | 繁體中文English

关于本书

本项目旨在打造一本开源免费、新手友好的数据结构与算法入门教程。

  • 全书采用动画图解,内容清晰易懂、学习曲线平滑,引导初学者探索数据结构与算法的知识地图。
  • 源代码可一键运行,帮助读者在练习中提升编程技能,了解算法工作原理和数据结构底层实现。
  • 鼓励读者互助学习,提问与评论通常可在两日内得到回复。

若本书对您有所帮助,请在页面右上角点个 Star ⭐ 支持一下,谢谢!

推荐语

“一本通俗易懂的数据结构与算法入门书,引导读者手脑并用地学习,强烈推荐算法初学者阅读。”

—— 邓俊辉,清华大学计算机系教授

“如果我当年学数据结构与算法的时候有《Hello 算法》,学起来应该会简单 10 倍!”

—— 李沐,亚马逊资深首席科学家

贡献

本开源书仍在持续更新之中,欢迎您参与本项目,一同为读者提供更优质的学习内容。

  • 内容修正:请您协助修正或在评论区指出语法错误、内容缺失、文字歧义、无效链接或代码 bug 等问题。
  • 代码转译:期待您贡献各种语言代码,已支持 Python、Java、C++、Go、JavaScript 等 12 门编程语言。
  • 中译英:诚邀您加入我们的翻译小组,成员主要来自计算机相关专业、英语专业和英文母语者。

欢迎您提出宝贵意见和建议,如有任何问题请提交 Issues 或微信联系 krahets-jyd

感谢本开源书的每一位撰稿人,是他们的无私奉献让这本书变得更好,他们是:

License

The texts, code, images, photos, and videos in this repository are licensed under CC BY-NC-SA 4.0.

hello-algo's People

Contributors

cathay-chen avatar codingonion avatar curtishd avatar danielsss avatar fangyuan33 avatar gn-yu avatar gonglja avatar guowei-gong avatar gvenusleo avatar gyt95 avatar hello-ikun avatar hpstory avatar ischristina avatar justin-tse avatar k3v123 avatar khoaxuantu avatar krahets avatar longsizhuo avatar mgisr avatar mingxta avatar msk397 avatar night-cruise avatar nuomi1 avatar pengchzn avatar reanon avatar rivertwilight avatar s-n-o-r-l-a-x avatar xblackicex avatar zhuoqinyue avatar zuoxun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hello-algo's Issues

How to fix the bug of arrayToTree function?

I found a bug in the arrayToTree function, I tried to modify the logic of arrayToTree, but it didn't solve the problem, please help me!Here are the details:

  • input
const arr = [1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15];
  • wrong output
        /——— 7
       |    \——— 12
    /——— 3
   |    \——— 6
——— 1
    \——— 2
       |    /——— 9
        \——— 4
           |    /——— 15
            \——— 8
  • The correct output should be
            /——— 15
        /——— 7
    /——— 3
   |    \——— 6
   |        \——— 12
——— 1
    \——— 2
       |    /——— 9
        \——— 4
            \——— 8
  • The location of the arrayToTree function
hello-algo/codes/javascript/modules/TreeNode.js
  • my question
    If you want to pass the above case, how to modify the logic of the arrayToTree function?

Code Transpilation to multiple progamming languages (Help Wanted)

Tip

We seek help translating the code from one programming language to another.
Feel free to contribute in programming languages not listed here, such as PHP, R. Ruby, Kotlin, etc.

Contributing Guideline

  • Select a reference language: Python or Java are the preferred reference languages since their codebase has been thoroughly tested.
  • Maintain code consistency: Align your code structure, naming conventions, and comments with those in the reference language to minimize discrepancies.
  • Test the code: Ensure your code produces the same output as the reference code. Recommend utilizing tools like Diffchecker to compare the outputs.
  • Format the code: Before opening the pull request, check your code formatting against existing chapters for consistent indentation, comment style, and naming conventions. Standard code formatting tools are recommended.
  • PR examples:

Code Reviewers

If you have extensive programming experience and are interested in reviewing code, please reach out via WeChat at krahets-jyd . We dedicate our thanks to all code reviewers on the landing page and of this project.

Language Reviewer
Java @krahets
C++
Python @krahets
Go #222 @Reanon
JavaScript #120 @justin-tse
TypeScript #121 @justin-tse
C# @hpstory
C #425 @Gonglja
Swift @nuomi1
Rust @night-cruise
Ruby @khoaxuantu
Dart @gvenusleo
Kotlin @curtishd
Zig @codingonion

Consider adding an English version of this book

作者是否有考虑给本书制作一个英文翻译版本?我可以提供英文翻译。

浅谈一下读完本书的感想以及为什么需要一个英文版本:

本人是算法小白,之前接触过一些算法的知识,但是都是不系统的学习,要用到什么就学什么,导致整个知识体系非常零散。最近由于要开始准备一些面试和考试才开始系统性地学,之前选中这本书就是因为讲解通俗易懂而且内容简洁,篇幅普遍不长,对初学者非常友好。我大概花了不到一周就集中把整本书啃完了,收获良多,算法至少是入门了。这本书和我看过的别的材料最大的不同就是这本书给了我看完的勇气和毅力,之前从来没有认认真真地从头到尾看完过一本CS的书,大部分CS的书籍真的太臃肿且晦涩了,这本书真的是面向小白的最佳材料。

我正在国外某所学校学习CS,然而即使是国外大学所谓“先进”的CS教学,他们的算法课程也真的很烂,内容臃肿,重点不清,讲解混乱,从头到尾糊里糊涂地就混过去了(一学期下来的效果还不如我一周看完这本书),而和我一起上课的大部分外国学生也是学的云里雾里。当然国外也有和这本书类似的面向初学者的材料,但是这些材料通常都不开源且要收费,而国外教材费真的非常高昂,一套书的价格甚至可能和一部手机一样贵,网上的教程和材料也同样需要购买。所以我认为如果本书有一个英文版本的话真的会非常有意义(我认为本书可以参考李沐老师的d2l课程材料类似的模式)。

Code Translation to Rust (Help Wanted)

We need your help translating the code to Rust.

Please check the contribution guidelines in #15.

  • Computational Complexity @Loner1024
    • Performance Evaluation
    • Time Complexity
    • Space Complexity
    • Space Time Tradeoff
  • Array And LinkedList
    • Array
    • LinkedList
    • List
  • Stack And Queue
    • Stack
    • Queue
    • Deque
  • Hashing
    • Hash Map
    • Hash Collision
  • Tree
    • Binary Tree
    • Binary Tree Types
    • Binary Search Tree
    • AVL Tree
  • Searching
    • Linear Search
    • Binary Search
    • Hash Search
  • Sorting
    • Bubble Sort
    • Insertion Sort
    • Quick Sort
    • Merge Sort

You can comment on the tasks you want to receive below, and I will assign them to you.
Notice: please use "part of" not "resolves" or "fixes", or it will close this original issue

你可以在下面评论你想要收到的任务,我会把它们分配给你。
注意:请使用“part of”而不是“resolves”或“fixes”,否则将关闭此原始问题

Code Transpilation to JavaScript (Help Wanted)

Could you help us translate the code to JavaScript:

Please check the contribution guidelines at #15.

data and memory中的部分意见

关于此处char 的类型 在大多数语言中 是 char 可以看做是int8 所以 正常来说 符号是从 0-127表示的 ASICII码
而且是区分 unsigned 和 signed, 所以这里直接是2 bytes char 还有 默认是unsigned的 我是不认同的。

| 字符 | **char** | 2 bytes / 1 byte | $0$ ~ $2^{16} - 1$ | $0$ |

还有此处没有将原码 反码 补码的情况下, 我认为在计算机中存储的就是补码。默认的整数在不区分unsigned 和signed 的情况下我更倾向于signed int32数据类型,则补码表示的负数 会比 正数多一个。

https://github.com/krahets/hello-algo/blob/7ca27c3df1bfc981fc7faa4528dadb410457d221/docs/chapter_data_structure/data_and_memory.md?plain=1#LL36C4-L36C65

快速排序部分,最后一步代码基准值跟分界线交换问题

大佬你好,最近看您的书籍快速排序部分时,在一次循坏结束时,也就是这一步
swap(nums, i, left); // 将基准数交换至两子数组的分界线
这一步代码里面好像是直接的值交换,而不是把基准值放到左子数组跟右子数组的分界线处,图解部分也是直接做值交换的,但是会不会有可能基准值比被交换值要小的情况呢,如果是这样的话,直接交换就出问题了,我是自己用java写的发现这个问题,不知道c语言是不是这样,初学算法,希望大佬指出。

Add golang code to docs

There are some Go codes translated from Java codes, someone needs to help with adding them to docs.

Writing Kanban

Please feel free to drop your comments and expectations about this book to us.

Chapter Section Status Author To-dos
Introduction Algorithms are everywhere Completed @krahets  
Introduction What is DSA Completed @krahets  
Introduction Summary Completed @krahets  
Computational Complexity Performance evaluation Completed @krahets  
Computational Complexity Time complexity Completed @krahets  
Computational Complexity Space complexity Completed @krahets  
Computational Complexity Space-Time tradeoff Completed @krahets  
Computational Complexity Summary Completed @krahets  
Data Structure Classification of data structure Completed @krahets  
Data Structure Number encoding Completed @krahets  
Data Structure Character encoding Completed @krahets  
Data Structure Summary Completed @krahets  
Array And LinkedList Array Completed @krahets  
Array And LinkedList Linked List Completed @krahets  
Array And LinkedList Dynamic array Completed @krahets  
Array And LinkedList Summary Completed @krahets  
Stack And Queue Stack Completed @krahets  
Stack And Queue Queue Completed @krahets  
Stack And Queue Deque Completed @krahets, @FangYuan33  
Stack And Queue Summary Completed @krahets  
Hashing Hash Map Completed @krahets  
Hashing Hash Collision Completed @krahets  
Hashing Hash Algorithm Completed @krahets  
Hashing Summary Completed @krahets  
Tree Binary Tree Completed @krahets  
Tree Binary Tree Traversal Completed @krahets  
Tree Binary Tree Representation Completed @krahets  
Tree Binary Search Tree Completed @krahets  
Tree AVL Tree Completed @krahets, @mgisr  
Tree Summary Completed @krahets  
Heap Heap Completed @krahets  
Heap Building Heap Completed @krahets  
Heap Top-K Problem Completed @krahets  
Heap Summary Completed @krahets  
Graph Graph Completed @krahets  
Graph Basic Operation of Graph Completed @krahets  
Graph Graph Traversal Completed @krahets  
Graph Summary Completed @krahets  
Searching Binary Search Completed @krahets  
Searching Binary Search Edge Completed @krahets  
Searching Replace linear by hashing Completed @krahets  
Searching Searching algorithm revisited Completed @krahets  
Searching Summary Completed @krahets  
Sorting Sorting Completed @krahets  
Sorting Selection Sort Completed @krahets  
Sorting Bubble Sort Completed @krahets  
Sorting Insertion Sort Completed @krahets  
Sorting Selection Sort Completed @krahets  
Sorting Quick Sort Completed @krahets  
Sorting Merge Sort Completed @krahets  
Sorting Heap Sort Completed @krahets  
Sorting Bucket Sort Completed @krahets  
Sorting Counting Sort Completed @krahets  
Sorting Radix Sort Completed @krahets  
Sorting Summary Completed @krahets  
Divide and Conquer Divide and Conquer Algorithm Completed @krahets  
Divide and Conquer Binary Search Recur Completed @krahets  
Divide and Conquer Build Tree Problem Completed @krahets  
Divide and Conquer Hanota Problem Completed @krahets  
Divide and Conquer Summary Completed @krahets  
Backtracking Backtracking Algorithm Completed @krahets  
Backtracking Permutations Problem Completed @krahets  
Backtracking Subset sum Problem Completed @krahets  
Backtracking N Queens Problem Completed @krahets  
Backtracking Summary Completed @krahets  
Dynamic Programming Introduction to DP Completed @krahets  
Dynamic Programming DP Problem Features Completed @krahets  
Dynamic Programming DP Solution Pipeline Completed @krahets  
Dynamic Programming 0-1 Knapsack Completed @krahets  
Dynamic Programming Unbounded Knapsack Completed @krahets  
Dynamic Programming Edit Distance Completed @krahets  
Dynamic Programming Summary Completed @krahets  
Greedy Greedy Algorithm Completed @krahets  
Greedy Fractional Knapsack Problem Completed @krahets  
Greedy Max Capacity Problem Completed @krahets  
Greedy Max Product Cutting Problem Completed @krahets  
Greedy Summary Completed @krahets  

考虑添加本地部署的教程

方便离线观看或者修改章节后可以看看修改后的效果再提交代码
我通过以下命令成功的启动了本地服务

pip install mkdocs mkdocs-material
mkdir docs/overrides
mkdocs build
mkdocs serve

可以考虑提供Dockerfile或者现成的镜像

是否考虑支持动画?

@krahets 您好,这本算法书里的插图画的很漂亮,但是是以静态的幻灯片的形式展示出来的。
您有没有考虑过在算法书中插入一些动画?这样在演示算法的运行过程会更加生动和直观。
如果您感兴趣的话,可以了解一下我最近在开发的一款基于 Python 的算法动画引擎 algviz Github 仓库

例如下面的动画都是用这款引擎渲染出来的:

  • 冒泡排序算法:
    bubble_sort_animation

  • N 皇后问题:
    NQueens_animation

  • Prim 最小生成树算法:
    Prim_animation

更多算法可以直接点击下面的按钮在线运行体验一波,所有的动画都会根据您的输入以及算法的运行实时渲染:

Open in Gitpod

期待您的回复!

mkdocs出现404,以及代码无法正常渲染

我试着贡献一点代码,但尝试参与遇到的问题,

1:Docker渲染下网页代码部分无法渲染,只是出现

[class]{}-[func]{randomAccess}

2:使用对应版本的mkdocs等,发现所有的网页都是404
`pip install --upgrade pip
pip install mkdocs-material==9.0.13
mkdocs serve

INFO - [11:42:16] Watching paths for changes: 'build', 'mkdocs.yml'
INFO - [11:42:16] Serving on http://127.0.0.1:8000/
WARNING - [11:42:18] "GET / HTTP/1.1" code 404
WARNING - [11:42:18] "GET /stylesheets/extra.css HTTP/1.1" code 404
WARNING - [11:42:18] "GET /assets/images/logo.png HTTP/1.1" code 404
WARNING - [11:42:19] "GET /javascripts/mathjax.js HTTP/1.1" code 404
`

疑似bug

/codes/python/include/binary_tree.py 中的list_to_tree(arr)用的时候会报list index out of range

Specify the data model of basic_data_types

本问题发现于 C 和 C++ 中,其他语言不了解,不清楚有没有问题。

C 和 C++ 从来没有规定 byte, char short, int, long 等的具体大小,而只要求了一个大小范围,也没有要求 1 byte == 8 bits,如果不指明这一点,可能给不了解的读者带来错误印象:我在交流中已发现有人因为这样的错误印象(不一定是由本书造成的)而犯错。

TL;DR 建议做一下补充以下两点:

  • 指出在部分语言标准(如 C、C++)中,这些类型没有固定的大小,而因实现、平台而异。
  • 指明所使用的 data model 为 LP64,这能与目前的表格对应。

byte:

C: — addressable unit of data storage large enough to hold any member of the basic character set of the
execution environment. 3.6

C++: A byte is at least large enough to contain the ordinary literal encoding of any element of the basic literal character set and the eight-bit code units of the Unicode UTF-8 encoding form and is composed of a contiguous sequence of bits, the number of which is implementation-defined. ... Every byte has a unique address. [intro.memory]/1

可见并没有要求 1 byte == 8bits。


以下仅查找 C++ 标准,C 标准查起来太麻烦了,但根据 cppreference 是差不多的。

char:

char 是字符类型,而 signed charunsigned char 是与它不同的类型,char 所使用的内置类型是 signed char 还是 unsigned char 由实现决定。

narrow character type: The three types char, signed char, and unsigned char are collectively called ordinary character types. The ordinary character types and char8_t are collectively called narrow character types. [basic.fundamentals]/7

sizeof 返回什么: The sizeof operator yields the number of bytes occupied by a non-potentially-overlapping object of the type of its operand. [expr.sizeof]/1

sizeof(narrow character type): The result of sizeof applied to any of the narrow character types is 1. [expr.sizeof]/1

因此 sizeof(char) == 1,即 C++ 中 char 的大小为 1 byte。

其他文中提及的类型:

  • minimum_bits(signed char) == 8, minimum_bits(short int) == 16, minimum_bits(int) == 16, minimum_bits(long int) == 32.
  • 1 == sizeof(char) ≤ sizeof(short) ≤ sizeof(int) ≤ sizeof(long) ≤ sizeof(long long).

正文演示代码语言排序

随着支持的语言越来越多,正文在多人协作时可能会遇到先后顺序导致的合并冲突。依据本书把 Java 语言作为范本的共识,建议按照 Java / C / C++ / C# / Go / JavaScript / Python / Swift / TypeScript / Zig 进行排序,确保首选语言不出现空白和减少合并冲突。

注:除 Java 外,其余语言顺序来自 codes 文件夹在 GitHub 中的展示顺序。

图的基本操作: https://www.hello-algo.com/chapter_graph/graph_operations/#1023。在使用邻接表添加边bug

在使用邻接表添加边这里有问题, 如果边已经存在那么他还是会添加进去

 /* 添加边 */
    public void addEdge(Vertex vet1, Vertex vet2) {
        if (!adjList.containsKey(vet1) || !adjList.containsKey(vet2) || vet1 == vet2)
            throw new IllegalArgumentException();
        // 添加边 vet1 - vet2
        adjList.get(vet1).add(vet2);
        adjList.get(vet2).add(vet1);
    }

我做的修改是

    public void addEdge(Vertex vet1, Vertex vet2) {
        if (!adjList.containsKey(vet1) || !adjList.containsKey(vet2) || vet1 == vet2)
            throw new IllegalArgumentException();
        // 添加边 vet1 - vet2
        if (!adjList.get(vet1).contains(vet2)){
            adjList.get(vet1).add(vet2);
        }   
        if (!adjList.get(vet2).contains(vet1)){
            adjList.get(vet2).add(vet1);
        }
        
        
    }

Is there an english version of this book?

I used google translate to view the book's contents and found it helpful. But the problem is that google translate is limited to the translation of text only not images, so it is tough for me to understand the code.

时间复杂度 线性对数阶python代码貌似有问题

```
""" 线性对数阶 """
def linear_log_recur(n):
    if n <= 1: return 1
    count = linear_log_recur(n // 2) + \
            linear_log_recur(n // 2)
    for _ in range(n):
        count += 1
    return count
```
  • 当n为浮点数时,for循环报错
TypeError: 'float' object cannot be interpreted as an integer
  • 我更改了一版,麻烦看一下可以不,可以的话我提交pr
""" 线性对数阶 """
def linear_log_recur(n):
    if n <= 1: return 1
    count = linear_log_recur(n / 2) + \
            linear_log_recur(n / 2)
    i = 0
    while i < n:
        count += 1
        i += 1
    return count

书写错误问题,在【 第4章 - 4.2 链表】中。

原文:

单向链表:即上述介绍的普通链表。单向链表的节点包含值和指向下一节点的引用两项数据。我们将首个节点称为头节点,将最后一个节点成为尾节点,尾节点指向空 None。

应该是:将最后一个节点称为(而不是 “成为”)尾节点,尾节点指向空 None。

重构目录结构

  1. 将目录结构重构为横版
  2. 将栈队列,数据结构,哈希等内容合并为数据结构一览
  3. 重构文件夹

Code Transpilation to C (Help Wanted)

We need your help translating the code to C.

Please check the contribution guidelines at #15

TODO List

双端队列

halo, K神,双端队列没有做基于数组和双向链表的代码实现,栈和队列都是有这一部分的,双端队列的实现我能帮忙写一下吗?

考虑添加基数排序说明

个人认为基数排序是一种区别于其他排序的典型的、具有鲜明特色的排序方法,可以考虑将其加入

Code Transpilation to TypeScript (Help Wanted)

Could you help us translate the code to TypeScript:

Please check the contribution guidelines at #15.

[golang] graphAdjList: removeEdge operation doesn't really remove the edge we wanted

  • Run TestGraphAdjList in graph_adjacency_list_test.go, you will get following result:

=== RUN TestGraphAdjList
初始化后,图为:
邻接表 =
1: 3 5
3: 1 2
5: 1 2 4
2: 3 5 4
4: 2 5

添加边 1-2 后,图为
邻接表 =
1: 3 5 2
3: 1 2
5: 1 2 4
2: 3 5 4 1
4: 2 5

删除边 1-3 后,图为
邻接表 =
1: 3 5 2 # 异常点: 3 应该被移除
3: 1 2 # 异常点:1 应该被移除
5: 1 2 4
2: 3 5 4 1
4: 2 5

添加顶点 6 后,图为
邻接表 =
2: 3 5 4 1
4: 2 5
6:
1: 3 5 2
3: 1 2
5: 1 2 4

删除顶点 3 后,图为
邻接表 =
4: 2 5
6:
1: 3 5 2 # 3 应该被移除
5: 1 2 4
2: 3 5 4 1 # 3 应该被移除

  • 暂时未查看其他语言的实现是否存在同样的问题。

rust "binary_search" return type -> choose uszie or i32 ?

I think the binary search in Rust could be written like this:

pub fn binary_search(nums: &[i32], target: i32) -> Option<usize> {
        let mut low = 0;
        let mut high = nums.len();
        while low < high {
            let mid = (high - low) / 2 + low;
            match target.cmp(&nums[mid]) {
                std::cmp::Ordering::Equal => return Some(mid),
                std::cmp::Ordering::Less => high = mid,
                std::cmp::Ordering::Greater => low = mid + 1,
            }
        }
        None
}

This is more in line with Rust's language features, maybe

Code Transpilation to Go (Help Wanted)

We need your help translating the code to Go.

Please check the contribution guidelines at #15

TODO List

Commit Guidelines

1、Format of the commit message
Refer to AngularJS Git Commit Message Conventions

<type>(<scope>): <subject>

Allowed <type>

  • feat: feature, complete a part of the code.
  • test: testcase.
  • fix: fix some bugs.
  • docs: documentation, complete a part of the doc.
  • style: formatting, …

Allowed <scope>

  • chapter_name/module_name

For example, if you complete the go code of linkedlist_queue in chapter_stack_and_queue, the commit message should be like:

feat(stack_and_queue/linkedlist_queue): add go code.

2、What one commit contains
If you complete two module code, testcase and docs, you commit log should be like:

docs(tree/binary_tree_bfs): add go code.
docs(stack_and_queue): add go code.
feat(stack_and_queue/linkedlist_queue): add go code and testcases.
test(tree/binary_tree_bfs): add go testcases.
feat(tree/binary_tree_bfs): add go code.

If you fix a bug, the commit log should be like :

docs(searching/linear_search): modify go code.
fix(searching/linear_search): fix go code.

Code Style

1、All code should be error-free when run through gofmt and go test.
2、Consistent with existing go code style.
3、Refer to uber/go-style.

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.