Commit Graph

197 Commits

Author SHA1 Message Date
krahets 4e13755023 Add implementation of array binary tree.
Rewrite the tree serialization and deserialization methods.
Add applications of array and linked list.
2023-07-19 16:09:27 +08:00
krahets 1f784dadb0 Add Java and C++ code for the chapter of
divide and conquer.
2023-07-17 04:20:12 +08:00
Yudong Jin c3f80e52af
Add the section of edit distance problem (#599) 2023-07-13 05:27:47 +08:00
krahets 1c02859b13 Add the section of unbounded knapsack problem. 2023-07-11 19:22:41 +08:00
krahets ad0fd45cfb Add Java and C++ code for the chapter of DP. 2023-07-11 01:08:26 +08:00
krahets cddddb8b8b Update knapsack_problem and intro_to_dp
Fix avl_tree
2023-07-09 02:39:58 +08:00
krahets 920512d872 Update the section of intro to DP. 2023-07-01 03:02:50 +08:00
Yudong Jin 3f03663d2e
feat: add the section of the introduction to dynamic programming (#571)
* add the section of the introduction to
dynamic programming

* add a code comments.
2023-06-30 04:31:43 +08:00
krahets 54dc288e61 1. Remove Pair class from hash coliision code.
2. Fix the comment in my_list code.
3. Add a Q&A to the summary of sorting.
2023-06-26 23:06:15 +08:00
Yudong Jin 1b1af8d038
Add Java and C++ code for the section hash algorithm (#560) 2023-06-21 19:26:16 +08:00
Yudong Jin 0e2ddba30f
Add the section of subset sum problem. (#558) 2023-06-21 02:58:24 +08:00
krahets 9fc1a0b2b3 Update n_queens code. 2023-06-21 02:56:28 +08:00
Yudong Jin 29e6617ec1
Add the section of hash algorithm. Refactor the section of hash map. (#555) 2023-06-16 21:20:57 +08:00
Yudong Jin 9563965a20
Add the codes of hashmap (#553)
of chaining and open addressing
2023-06-14 02:01:06 +08:00
krahets d3e597af94 Update cmakelists.txt 2023-06-13 21:16:54 +08:00
Yudong Jin a111b94f23
feat: Add the section of Top-K problem (#551)
* Add the section of Top-K problem

* Update my_heap.py

* Update build_heap.md

* Update my_heap.py
2023-06-12 23:04:01 +08:00
krahets 6377e3316a Fix a comment in my_list.xx 2023-06-03 22:18:28 +08:00
krahets b39e79be85 Fix remove() in binary search tree. 2023-05-26 20:34:22 +08:00
Yudong Jin ee716a2c23
feat: Add the section of heap sort. (#516)
* Add the section of heap sort.

* Update heap_sort.cpp
2023-05-26 04:46:56 +08:00
krahets dc49fdf75e Polish some contents. 2023-05-24 11:45:52 +08:00
Yudong Jin 77b4f4c400
Add the section of selection sort. (#513) 2023-05-24 00:35:46 +08:00
krahets 5dff1bd0e8 Update the insertion sort. 2023-05-24 00:33:27 +08:00
krahets eb8df49993 Update bubble sort and insertion sort. 2023-05-23 21:20:14 +08:00
krahets f6d290d903 Update the comments of bubble sort
and insertion sort
2023-05-22 23:05:37 +08:00
krahets d95c628eef Fix the test case of binary search. 2023-05-21 19:29:24 +08:00
krahets d3cc149c5a Merge the chapter of binary tree and searching. 2023-05-21 19:26:52 +08:00
Yudong Jin b5eb9ca271
feat: Add the section of binary search edge. (#508)
* Add the section of binary search edge.

* Delete binary_search_rotation.py
2023-05-21 19:04:21 +08:00
krahets c3e7455285 Refactor the section of bianry search. 2023-05-21 04:51:32 +08:00
krahets 399e5df39a Polish some cotents. 2023-05-18 20:27:58 +08:00
krahets 817b4598d5 Fix a comment in binary_search_tree code 2023-05-17 19:04:46 +08:00
krahets fe69f7240d Add figures to replace_linear_by_hashing.md 2023-05-09 00:36:18 +08:00
Yudong Jin 67d647ab59
feat: Add the section of n queens problem (#483)
* Add the section of n queens problem

* Update n_queens.py

* Update n_queens.java

* Update n_queens.cpp

* Update n_queens.java
2023-05-04 05:27:17 +08:00
krahets bc77a81330 Update the codes of backtracking. 2023-04-27 02:17:04 +08:00
krahets 3f430fb85e Update the code of permutations i and ii 2023-04-27 01:18:18 +08:00
krahets 145975b335 Rename the common modules in Java, C++ and C. 2023-04-24 04:11:18 +08:00
Yudong Jin c6eecfd0dc
feat: Add the section of permutations problem. (#476)
* Add the section of permutations problem.

* Update permutations_problem.md
2023-04-24 03:33:30 +08:00
krahets de579aa3f4 Fix the file headers. 2023-04-23 19:36:07 +08:00
krahets bad759b4f8 Rename the naming of the coding files
in backtracking algorithm.
Add the typedef to docs.
2023-04-22 01:38:53 +08:00
krahets 6723cdbc7e Represent null with INT_MAX in C, C++. 2023-04-18 14:31:23 +08:00
krahets 9a98ff8a5e Format the C code in Clang-Format Style: Microsoft 2023-04-17 21:13:15 +08:00
Yudong Jin 881d573790
Refactor the articles related to searching algorithm. Add the chapter of binary search. Add the section of searching algorithm revisited. (#464) 2023-04-17 18:22:18 +08:00
krahets 0ade8d87ad Update the page tree 2023-04-16 16:38:04 +08:00
krahets f5b8978330 Add cpp code for the backtrack algorithm. 2023-04-16 16:34:52 +08:00
Gonglja 8bc41bc013
Add space_complexit under C and fix memory leak under CPP (#456)
* fix(codes/cpp): Memory leak fix: the space was not freed when pop removed the element.

* fix(codes/cpp): Fix access error when printArray(arr, 0)

* fix(codes/cpp): Fix memory leaks: replace pointers with local variables, no need to manage memory

* fix(codes/cpp): Fix memory leaks: no delete

* fix(codes/cpp): Fix memory leaks: Add destructor ~ArrayHashMap()

* Update PrintUtil.hpp

* feat(codes/c): Add three-party hash implementation

* feat(codes/c): Add freeMemoryTree in tree_node.h

* feat(codes/c): Add space_complexity.c

* styles(codes/c): Modify format

* feat(codes/cpp): Undo a previous delete, there is no memory leak here

* Update array_hash_map.cpp

* Update include.h

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-04-15 23:51:35 +08:00
krahets f7ae9c8a02 Fix the return type of binary search tree and avl tree 2023-04-14 05:47:20 +08:00
krahets 9c9c8b7574 Format C++ codes in Clang-Format Style: Microsoft 2023-04-14 03:44:02 +08:00
krahets 0bec52d7cc Polish the chapter of heap, introduction, preface.
Replace "其它" with "其他"
2023-04-09 19:12:37 +08:00
Yudong Jin 1c8b7ef559
refactor: Replace 结点 with 节点 (#452)
* Replace 结点 with 节点
Update the footnotes in the figures

* Update mindmap

* Reduce the size of the mindmap.png
2023-04-09 04:32:17 +08:00
Yudong Jin 830ec69d39
Add bucket_sort.cpp and bucket_sort.py (#446) 2023-03-30 03:44:26 +08:00
Yudong Jin 34a1bca627
Add the section of radix sort. (#441) 2023-03-26 22:02:37 +08:00
Yudong Jin 65e47b0748
Add Python and C++ code for the counting sort. (#436) 2023-03-21 22:24:17 +08:00
Gonglja b9e97d3823
Fix access error when printArray(arr, 0) (#432)
* fix(codes/cpp): Memory leak fix: the space was not freed when pop removed the element.

* fix(codes/cpp): Fix access error when printArray(arr, 0)

* Update PrintUtil.hpp

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-03-20 21:26:20 +08:00
Gonglja 0659c54e77
Fix memory leaks (#433)
* fix(codes/cpp): Memory leak fix: the space was not freed when pop removed the element.

* fix(codes/cpp): Fix access error when printArray(arr, 0)

* fix(codes/cpp): Fix memory leaks: replace pointers with local variables, no need to manage memory
2023-03-20 21:17:19 +08:00
Gonglja 3173d02538
fix(codes/cpp): Memory leak fix: the space was not freed when pop removed the element. (#423) 2023-03-19 23:46:48 +08:00
krahets 28f3c98697 Fix avl_tree.cpp 2023-03-16 22:50:17 +08:00
krahets 0840bc2043 Fix the deconstructor of linkedlist_queue.cpp 2023-03-16 18:43:13 +08:00
krahets 518b9efabc Update a comment in array_hash_map 2023-03-15 03:48:31 +08:00
krahets d5afd93571 Update array_hash_map 2023-03-15 03:11:43 +08:00
krahets d37d704b18 Update CMakeLists.txt for C++ 2023-03-15 01:43:28 +08:00
Gonglja 567497a6b8
Add cpp codes cmake build method (#419)
* feat(codes/cpp): Add cmake build method

* feat(codes/cpp): Modify the cpp support version to c++17

* feat(codes/cpp): fix graph_adjacency_list.cpp cannot be compiled into an executable

* style(codes/cpp): Adjust the code to enhance compatibility.

* feat(codes/cpp): Change cpp version from 17 to 11.
2023-03-14 20:40:33 +08:00
Yudong Jin 28aacccf44
refactor: Replace 'poll' with 'pop' in Heap (#416) 2023-03-13 22:31:05 +08:00
Yudong Jin 8aebbaad21
refactor: Replace poll with pop in Queue and Deque (#415) 2023-03-13 21:58:21 +08:00
krahets 82bbdd444d Update the chapter of stack and queue. 2023-03-12 04:14:36 +08:00
Yudong Jin 33c797efeb
feat: Add C++ code for the graph bfs and dfs (#401)
* Add C++ code for the graph bfs and dfs

* Add C++ code for the graph bfs and dfs
2023-03-02 18:57:33 +08:00
Yudong Jin 4f941e3d99
Add C++ code for the linkedlist deque and array deque (#400) 2023-03-02 03:00:14 +08:00
krahets 9ea24e8b26 Change the operations sequence of the likedlist's insert() method. 2023-02-27 20:25:43 +08:00
krahets 0b72fef381 Fix quick_sort.py 2023-02-21 21:51:56 +08:00
方圆 f0d8d8b1b0
feat: add ArrayDeque (#348)
* 双向队列: java 代码

* 双向队列: markdown 内容

* Rewrite array_deque.java
Update array_queue.java, linkedlist_deque.java

* Add ArrayDeque figures and rewrite the contents

---------

Co-authored-by: krahets <krahets@163.com>
2023-02-16 02:17:15 +08:00
krahets 7238c560d1 Update binary_tree_bfs codes 2023-02-15 03:36:22 +08:00
krahets 8e0080f003 Update graph codes 2023-02-15 03:35:54 +08:00
Leo.Cai d3ea84ba97
Add graph c++ code (#357)
* add c++ graph code

* fix the header

* delete the header wrongly auto added by editor

* fix for format

* fix code style

* fix code style

* fix graph_adjacency_list.cpp,alter 构造函数 to 构造方法

* update the markdown

* add deconstructor

* remove the deconstructor

* Update graph_adjacency_matrix.cpp

* Update graph_adjacency_list.cpp

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-02-11 18:07:01 +08:00
LoneRanger 8d8b713865
fix poll() in my_heap.cpp (#360) 2023-02-11 18:04:29 +08:00
krahets 300016393b Add code source blocks to the chapter Graph.
Fix "函数" and "方法"
2023-02-10 01:04:26 +08:00
krahets 6dc21691ed Add build scripts for C# and
unify the coding style.
2023-02-08 22:18:02 +08:00
krahets 05f0054005 Add build script for JS and TS codes. 2023-02-08 19:45:06 +08:00
krahets 0407cc720c Fix Repo 2023-02-08 04:17:26 +08:00
krahets 8f512c2840 Update code extractor of Java. 2023-02-07 19:05:19 +08:00
krahets ecbf2d1560 1. Add build script for Java.
2. Add height limitation for code blocks in extra.css.
3. Fix "节点" to "结点".
2023-02-07 04:43:52 +08:00
LoneRanger 7f4243ab77
fix Pointer recycle (#346) 2023-02-07 01:17:10 +08:00
Yudong Jin f14e3e4c57 Update linear_search and hashing_search. 2023-02-04 23:49:37 +08:00
LoneRanger 0b16a9f6a9
Part Heap : Code Translation into C++ (my_heap.cpp) (#321)
* 增加my_heap.cpp并补充对应的文档

* 修改heap.md

* Update my_heap.cpp

* Update heap.md

* Update my_heap.cpp

* Update my_heap.cpp

* Update heap.md

* Update my_heap.cpp

* Update my_heap.cpp

* Update heap.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-02-04 16:33:46 +08:00
Yudong Jin e1abbcbf23 Update #320 2023-02-04 15:58:39 +08:00
Leo.Cai e5ae3e1cab
add avl tree and heap part cpp code (#320)
* 将avl_tree翻译成c++代码(文档明天补)

* markdown翻译了

* avl_tree.cpp翻译了

* 堆的cpp翻译

* modify the code format

* Update heap.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-02-04 15:53:58 +08:00
Yudong Jin 6ca5fa7d93 Update heap.cpp 2023-02-04 14:41:31 +08:00
LoneRanger 8e9eecd610
Part Heap : Code Translation into C++ (heap.cpp) (#285)
* 添加heap章节C++版本关于heap的相关操作

* 完善C++版本的heap相关操作

* 完善C++版本的heap相关操作

* fix printHeap function
2023-02-04 14:35:45 +08:00
Yudong Jin 70dead5cd0 Update worst_best_time_complexity,
leetcode_two_sum
2023-02-03 18:53:15 +08:00
Yudong Jin 7d14c9440e Unify the function naming of
queue from `offer()` to `push()`
2023-02-02 01:43:01 +08:00
Yudong Jin 5eae708035 Fix array queue. 2023-02-01 03:23:29 +08:00
Yudong Jin ddd5562b60 Fix the index out of bound check in my_list. 2023-01-30 17:50:07 +08:00
Yudong Jin 2336fe1d50 Update the comments in
binary_search_tree and avl_tree.
2023-01-17 01:53:12 +08:00
Yudong Jin 5f0ae848c4 Update medianThree() in quick_sort. 2023-01-15 23:32:58 +08:00
Yudong Jin 3e19205c84 Update a comment in binary_search_tree. 2023-01-15 15:43:06 +08:00
Yudong Jin bb657f9517 Add destructors to the C++ codes. 2023-01-14 19:52:11 +08:00
ubuntu 08afeb2981 fix(codes/cpp): fix worst_best_time_complexity.cpp compile error. 2023-01-11 22:50:23 +08:00
Yudong Jin daa28be3e4
Merge branch 'master' into binary_search_tree 2023-01-10 13:30:38 +08:00
龚国玮 96d54bff3a test(binary_search_tree): update test param all the language
use param value 7, not 5. function test param value with param value in example picture as same.
2023-01-10 12:16:02 +08:00
Yudong Jin d6d6a16c7e Update the access() function of linked_list 2023-01-10 00:46:04 +08:00
Yudong Jin 4d01436138 Remove avl_tree.cpp to match the latest docs. 2023-01-09 02:30:10 +08:00
Yudong Jin dcc3b2e35b Optimize arrToTree function
in java, cpp, py, go, js, ts.
2023-01-08 19:03:22 +08:00
dumingyu 98d1244e32 fix(codes/cpp): add climits headers
This fixes clang++ compile error when using INT_MAX in PrintUtil.
2023-01-06 11:00:12 +08:00