Skip to content

Commit

Permalink
feat: english version thinkings
Browse files Browse the repository at this point in the history
  • Loading branch information
robot committed Apr 16, 2022
1 parent ce3495d commit fa597b0
Show file tree
Hide file tree
Showing 26 changed files with 242 additions and 2,353 deletions.
44 changes: 27 additions & 17 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# LeetCode

[![Travis](https://img.shields.io/badge/language-C++-green.svg)]()
[![Travis](https://img.shields.io/badge/language-JavaScript-yellow.svg)]()
[![Travis](https://img.shields.io/badge/language-Python-red.svg)]()
[![Travis](https://img.shields.io/badge/language-Java-blue.svg)]()
![Total visitor](https://visitor-count-badge.herokuapp.com/total.svg?repo_id=azl397985856.leetcode.en)
![Visitors in today](https://visitor-count-badge.herokuapp.com/today.svg?repo_id=azl397985856.leetcode.en)
[![Travis](https://img.shields.io/badge/language-C++-green.svg)]() [![Travis](https://img.shields.io/badge/language-JavaScript-yellow.svg)]() [![Travis](https://img.shields.io/badge/language-Python-red.svg)]() [![Travis](https://img.shields.io/badge/language-Java-blue.svg)]() ![Total visitor](https://visitor-count-badge.herokuapp.com/total.svg?repo_id=azl397985856.leetcode.en) ![Visitors in today](https://visitor-count-badge.herokuapp.com/today.svg?repo_id=azl397985856.leetcode.en)

> since 2019-09-03 19:40
Expand All @@ -15,8 +10,7 @@

![leetcode.jpeg](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltwf4xivj30dw0780sm.jpg)

This comment has been minimized.

Copy link
@VarathaRamanujam

VarathaRamanujam Aug 17, 2022

explain about this line

This comment has been minimized.

Copy link
@lording

lording via email Aug 17, 2022

This comment has been minimized.

Copy link
@azl397985856

azl397985856 Aug 18, 2022

Owner

line 36?


This essay records the course of and my emotion to this project from initialization to 10,000 stars.
[Milestone for 10,000+ stars](./thanksGiving.md)
This essay records the course of and my emotion to this project from initialization to 10,000 stars. [Milestone for 10,000+ stars](./thanksGiving.md)

If you are interested in this project, **do not mean your star**. This project will be **supported for a long enough time** by the community. Thanks for every audience and contributor.

Expand Down Expand Up @@ -96,7 +90,7 @@ The data structures mainly include:

> Here only lists some **representative problems** but not all.
#### Easy
#### Easy

- [Easy Collection](https://github.com/azl397985856/leetcode/blob/master/collections/easy.en.md)

Expand Down Expand Up @@ -125,15 +119,31 @@ The data structures mainly include:

### Summary of Data Structures and Algorithm

- [Data Structure](./thinkings/basic-data-structure-en.md)
- [Basic Algorithm](./thinkings/basic-algorithm-en.md)
- [Basic data structure (overview)](./thinkings/basic-data-structure.en.md)
- [I have almost finished brushing all the linked topics of Lixu, and I found these things. 。 。](./thinkings/linked-list.en.md)
- [I have almost finished brushing all the tree questions of Lixu, and I found these things. 。 。](./thinkings/tree.en.md)
- [堆专题(上)](./thinkings/heap.en.md) (WIP)
- [I have almost finished brushing all the piles of questions, and I found these things. 。 。 (Second bullet)](./thinkings/heap-2.en.md)
- [I have almost finished brushing all the two-point questions of Lixiu, and I found these things. 。 。 (Part 1)](./thinkings/binary-search-1.en.md)
- [I have almost finished brushing all the two-point questions of Lixiu, and I found these things. 。 。 (Part 2)](./thinkings/binary-search-2.en.md)

<!-- - [基础算法](./thinkings/basic-algorithm.md) -->

- [Dynamic Programming](./thinkings/dynamic-programming.en.md)
- [Search Problems](./thinkings/search.en.md)
- [Binary Tree Traversal](./thinkings/binary-tree-traversal.en.md)
- [Dynamic Programming](./thinkings/dynamic-programming-en.md)
- [Huffman Encode and Run Length Encode](./thinkings/run-length-encode-and-huffman-encode-en.md)
- [Bloom Filter](./thinkings/bloom-filter-en.md)
- [String Problems](./thinkings/string-problems-en.md)
- [Sliding Window Technique](./thinkings/slide-window.en.md)
- [Trie](./thinkings/trie.en.md)
- [Backtracking](./thinkings/backtrack.en.md)
- [Run code and Huffman code](./thinkings/run-length-encode-and-huffman-encode.en.md)
- [Bloom filter](./thinkings/bloom-filter.en.md)🖊
- [Trie](./thinkings/trie.en.md)🖊
- [滑动窗口(思路 + 模板)](./thinkings/slide-window.en.md) (WIP)
- [Bit Operation](./thinkings/bit.en.md)
- [Kojima Question](./thinkings/island.en.md)🖊
- [GCD Problems](./thinkings/GCD.en.md)
- [Union Find (Disjoint Set) Problem](./thinkings/union-find.en.md)
- [Balanced Binary Tree](./thinkings/balanced-tree.en.md)
- [Reservoir Sampling](./thinkings/reservoid-sampling.en.md)
- [Monotonic stack](./thinkings/monotone-stack.en.md)

### Anki Flashcards

Expand Down
17 changes: 6 additions & 11 deletions thinkings/balanced-tree.en.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Balanced Binary Tree Topic
# Balanced Binary Tree

There are still some topics related to balancing binary trees, and they are all very classic. It is recommended that everyone practice. Today, I have selected 4 questions for everyone. If you thoroughly understand these questions, you should not be out of ideas when you encounter other balanced binary tree questions. After you understand my thoughts, it is recommended to find a few more topics to practice your hands and consolidate your learning results.

Expand Down Expand Up @@ -86,8 +86,7 @@ return self. isBalanced(root. left) and self. isBalanced(root. right)

**Complexity analysis**

- Time complexity: for isBalanced to say, since each node has at most be accessed once, this part of the time complexity is $O(N)$, while the dfs function each time it is call the number of not more than $log N$, so the total time complexity is $O(NlogN)$, where $N$ is a tree of nodes total.
-Spatial complexity: Due to the use of recursion, the bottleneck of spatial complexity here is in the stack space, so the spatial complexity is $O(h)$, where $H$ is the height of the tree.
- Time complexity: for isBalanced to say, since each node has at most be accessed once, this part of the time complexity is $O(N)$, while the dfs function each time it is call the number of not more than $log N$, so the total time complexity is $O(NlogN)$, where $N$ is a tree of nodes total. -Spatial complexity: Due to the use of recursion, the bottleneck of spatial complexity here is in the stack space, so the spatial complexity is $O(h)$, where $H$ is the height of the tree.

## 108. Convert an ordered array to a binary search tree (simple)

Expand Down Expand Up @@ -148,8 +147,7 @@ return root

**Complexity analysis**

-Time complexity: Since each node is accessed at most once, the total time complexity is $O(N)$, where $N$ is the length of the array.
-Spatial complexity: Due to the use of recursion, the bottleneck of spatial complexity here is in the stack space, so the spatial complexity is $O(h)$, where $H$ is the height of the tree. At the same time, because it is a balanced binary tree, $h$ is 就是 log N$.
-Time complexity: Since each node is accessed at most once, the total time complexity is $O(N)$, where $N$ is the length of the array. -Spatial complexity: Due to the use of recursion, the bottleneck of spatial complexity here is in the stack space, so the spatial complexity is $O(h)$, where $H$ is the height of the tree. At the same time, because it is a balanced binary tree, $h$ is 就是 log N$.

## 109. Ordered linked list conversion binary search tree (medium)

Expand Down Expand Up @@ -184,8 +182,7 @@ The same idea as 108. The difference is the different data structures, so we nee

Let's take a look at the linked list again:

![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghluhpjgtqj31q30u0mzv.jpg)
(The case of the linked list)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghluhpjgtqj31q30u0mzv.jpg) (The case of the linked list)

To find the midpoint, you only need to use the classic speed pointer. At the same time, in order to prevent the ring from appearing, we need to cut off the next pointer to mid, so we need to record a node before the midpoint. This only needs to be recorded with a variable pre.

Expand Down Expand Up @@ -296,8 +293,7 @@ return root;
Let n be the length of the linked list.
- Time complexity: the recursion tree of depth $logn$, each layer of the basic operation of the number of $n$, so the total time complexity is$O(nlogn)$
-Spatial complexity: The spatial complexity is$O(logn)$
- Time complexity: the recursion tree of depth $logn$, each layer of the basic operation of the number of $n$, so the total time complexity is$O(nlogn)$ -Spatial complexity: The spatial complexity is$O(logn)$
Some students are not very good at analyzing the time complexity and space complexity of recursion. We will introduce it to you again here.
Expand All @@ -309,8 +305,7 @@ The time complexity is a little bit more difficult. Before, Sifa told everyone i
However, we found that the basic operands of each layer of the recursive tree are fixed, and the number of fixed operations has been calculated for everyone on the graph. Therefore, the total spatial complexity can actually be calculated by the \*\* recursion depth\* The basic operands of each layer, which is $nlogn$. Similar techniques can be used in the complexity analysis of merge sorting.
In addition, everyone can directly derive it from the formula. For this question, set the basic operand T(n), then there is T(n)= T(n/2)\*2+ n/2, and it is deduced that T(n) is probably nlogn. This should be high school knowledge.
The specific derivation process is as follows:
In addition, everyone can directly derive it from the formula. For this question, set the basic operand T(n), then there is T(n)= T(n/2)\*2+ n/2, and it is deduced that T(n) is probably nlogn. This should be high school knowledge. The specific derivation process is as follows:
$$
Expand Down
61 changes: 0 additions & 61 deletions thinkings/basic-algorithm-en.en.md

This file was deleted.

61 changes: 0 additions & 61 deletions thinkings/basic-algorithm-en.md

This file was deleted.

64 changes: 33 additions & 31 deletions thinkings/basic-algorithm.en.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,61 @@
# 基础算法
# Basic Algorithms

## 时间复杂度分析
## Analysis of Time Complexity

## 算法思想
## Algorithm Thoughts

### 贪心算法
### Greedy Algorithms

### 分治
### Divide-and-Conquer

### 动态规划
### Dynamic Programming

### 回溯法
### Backtracking

### 枚举法
### Enumeration

## 元算法
## Meta Algorithm

### Sorting Algorithms

Sorting algorithms are meta algorithm. Although they are not tested quit often, the core ideas are very useful.

### 排序算法
排序算法是一种元算法,直接考的很少,但是思想还是有用的。
#### O(n^2)

- 插入排序
- 选择排序
- 希尔排序
- 冒泡排序
- Insertion Sort
- Selection Sort
- Shell's Sort (aka Diminishing Increment Sort)
- Bubble Sort

#### O(nlogn)

- 快排
- 归并排序
- 堆排序
- Quick Sort
- Merge Sort
- Heap Sort

#### O(n)

- 桶排序
- 计数排序
- 基数排序
- Bucket Sort
- Counting Sort
- Radix Sort

### 查找算法
### Searching Algorithm

- 线性查找
- 树查找
- 散列表查找
- BFPRT Algorithm
- Search Trees
- Search by Hashing

## 字符串问题
## Algorithms for String

- 朴素
- KMP
- RK
- BM
- trie

## 其他
## Other

- 数论
- 概率论
- 并查集
- 矩阵运算
- Number Theory
- Probability Theory
- Union-find Algorithm
- Matrix Algorithms

0 comments on commit fa597b0

Please sign in to comment.