Commit graph

815 commits

Author SHA1 Message Date
nuomi1
170713c642
feat: add Swift codes for n_queens_problem article (#495)
* refactor: rename PreorderTraversalIIITemplate

* feat: add Swift codes for n_queens_problem article
2023-05-15 01:13:17 +08:00
krahets
649d8c4c86 Fix the indentation of JS and TS code. 2023-05-14 01:40:19 +08:00
liuyuxin
541f384e7c
Fix function call error and null safety (#491) 2023-05-14 01:19:06 +08:00
Justin Tse
b52a98f178
Add JavaScript and TypeScript code of permutations and n_queens (Chapter of Backtracking) (#494)
* Add JavaScript and TypeScript code of permutations and n_queens (Chapter of Backtracking)

* Update n_queens.js

* Update permutations_i.js

* Update permutations_ii.js

* Update n_queens.ts

* Update permutations_i.ts

* Update permutations_ii.ts

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-05-14 01:18:40 +08:00
Justin Tse
01345c23ca
Add JavaScript and TypeScript code of preorder traversal (Chapter of Backtracking) (#490)
* Add JavaScript and TypeScript code of preorder traversal (Chapter of Backtracking)

* Update preorder_traversal_iii_compact.ts
2023-05-11 23:46:12 +08:00
krahets
fe69f7240d Add figures to replace_linear_by_hashing.md 2023-05-09 00:36:18 +08:00
gonglja
53ca2144e2
Fix the problem in binary_tree_bfs.c and the problem that the memory is not released. (#487)
* 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

* fix(codes/c): Fix some errors of cmake build

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

* styles(codes/c): Modify function description

* styles(codes/c): Modify binary_search.c code style

* fix(codes/c): Fix the problem in binary_tree_bfs.c and the problem that the memory is not released.

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-05-09 00:01:23 +08:00
hpstory
40319e7f30
refactor: use global using to reduce usings in each file (#486) 2023-05-06 22:48:02 +08:00
krahets
db6caf0d43 Update n queens. 2023-05-05 03:42:01 +08:00
hpstory
7b1de228a0
feat(csharp/backtracking): add csharp code in n queens (#485)
* feat(csharp/backtracking): add csharp code in n queens

* fix format

* Update n_queens.cs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-05-05 03:34:52 +08:00
nuomi1
9ec560d6cd
feat: add Swift codes for permutations_problem article (#482) 2023-05-04 05:31:06 +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
78c84dfec6 Fix counting_sort.c 2023-05-03 22:58:48 +08:00
nuomi1
561ef20462
feat: add Swift codes for backtracking_algorithm article (#480)
* fix: compile error

* fix: package define

* feat: add Swift codes for backtracking_algorithm article
2023-05-03 18:45:43 +08:00
krahets
bc77a81330 Update the codes of backtracking. 2023-04-27 02:17:04 +08:00
krahets
9c070a028f Update the code of permutations I and II 2023-04-27 01:29:00 +08:00
krahets
3f430fb85e Update the code of permutations i and ii 2023-04-27 01:18:18 +08:00
hpstory
918380b56a
feat(csharp/backtracking): add csharp code in permutations (#478)
* feat(csharp/backtracking): add csharp code in permutations

* Update permutations_i.cs

* Update permutations_ii.cs

* Update permutations_ii.cs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-04-24 14:37:45 +08:00
krahets
40e6d2b415 Rename the common modules. 2023-04-24 04:20:51 +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
Guanngxu
95ed93dc4b
feat: add C array hash map (#424)
* feat: add C hash map

* fix: hash map put bug

* fix: C array hash map

* fix: Incorrect indentation

* refactory array hash map

* remove header

* refactory print

* 修改注释

* replace all the Tab with 4 spaces

* 向 cpp 靠拢

* 删除错误注释

* delete <stdlib.h>

* delete array_hash_map.h

* Update array_hash_map.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-04-23 23:44:49 +08:00
krahets
de579aa3f4 Fix the file headers. 2023-04-23 19:36:07 +08:00
krahets
3590262c7e Modify the exception handling in Java and Python. 2023-04-23 03:41:39 +08:00
krahets
73dcb4cea9 Reformat the C# codes.
Disable creating new line before open brace.
2023-04-23 03:03:12 +08:00
gonglja
ac6eece4f3
Modify code and comments (#473)
* 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

* fix(codes/c): Fix some errors of cmake build

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

* styles(codes/c): Modify function description

* styles(codes/c): Modify binary_search.c code style

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-04-22 02:03:24 +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
hpstory
9eeefff447
refactor: add/refactor method in include, simplified print code (#471) 2023-04-21 14:59:22 +08:00
xBLACKICEx
9c2e5e2831
feat(rust/tree): add binary_tree_bfs, binary_tree_dfs, (#450)
*  feat(rust/tree): add binary_tree_dfs

*  feat(rust/tree): add binary_tree_bfs

* 🐞 fix(rust/tree): can't list to any kind of tree
2023-04-21 14:58:46 +08:00
krahets
661603d467 Add the hashtable based on uthash.h to docs 2023-04-18 21:19:57 +08:00
Yudong Jin
dbc4906582
Publish the C codes to the docs. (#469) 2023-04-18 20:21:31 +08:00
krahets
6723cdbc7e Represent null with INT_MAX in C, C++. 2023-04-18 14:31:23 +08:00
krahets
af0f92c18d Fine tune the C codes. 2023-04-17 22:15:06 +08:00
krahets
c4ea4e39f3 Fomrat the JS and TS codes with prettier. 2023-04-17 21:58:11 +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
gonglja
28fdd26f2f
Fix some errors of cmake build and add hashing_search.c (#458)
* 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

* fix(codes/c): Fix some errors of cmake build

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

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-04-17 13:37:38 +08:00
hpstory
878f12f701
feat(csharp/backtracking): add csharp code in backtracking (#463) 2023-04-17 13:37:06 +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
krahets
1600ed6dee Fix the codes of backtracking. 2023-04-16 05:14:15 +08:00
Yudong Jin
49606fd199
Add the chapter of backtracking. (#459) 2023-04-16 04:52:42 +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
c8344e8636 Fix C# codes for the bucket sort,
counting sort and radix sort
2023-04-14 06:01:37 +08:00
hpstory
3b96ab6be9
feat(csharp/sorting): add bucked_sort, counting_sort, radix_sort (#455)
* feat(csharp/sorting): add bucked_sort, counting_sort, radix_sort

* use top level statements
2023-04-14 05:57:07 +08:00
krahets
b3640c53d1 Remove unused functions. 2023-04-14 05:52:59 +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
f8513455b5 Format the Java codes with the Reat Hat extension. 2023-04-14 00:12:10 +08:00
liuyuxin
e56cf7c65e
feat: add dart code for chapter_heap (#454) 2023-04-10 03:14:11 +08:00
krahets
0bec52d7cc Polish the chapter of heap, introduction, preface.
Replace "其它" with "其他"
2023-04-09 19:12:37 +08:00
krahets
10e2180013 Unify the comment style of python codes 2023-04-09 05:30:02 +08:00
Yudong Jin
5ddcb60825
Format python codes with black. (#453) 2023-04-09 05:05:35 +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
krahets
3f4e32b2b0 Polish the chapter of graph, hashing, appendix 2023-04-09 03:09:06 +08:00
Justin Tse
56243ccc5b
Add JavaScript and TypeScript code of bucket sort, counting sort and radix sort (Chapter of Sorting) (#451)
* Add JavaScript and TypeScript code of bucket sort (Chapter of Sorting)

* Add JavaScript and TypeScript code of counting sort (Chapter of Sorting)

* Add JavaScript and TypeScript code of radix sort (Chapter of Sorting)
2023-04-09 02:59:06 +08:00
liuyuxin
42c89be785
feat: add dart code for chapter_tree (#448) 2023-04-05 15:44:54 +08:00
Yudong Jin
830ec69d39
Add bucket_sort.cpp and bucket_sort.py (#446) 2023-03-30 03:44:26 +08:00
liuyuxin
684f27cf5e
feat: add dart code for chapter_stack_and_queue and chapter_hashing (#445)
* feat: add dart code for chapter stack and queue

* feat: add dart code for chapter_hashing

* Update array_hash_map.dart
2023-03-30 02:03:08 +08:00
Reanon
cac38c0c93
feat(bucket_sort): add bucket_sort code in go/c (#443)
* feat(bucket_sort): add bucket_sort code in go/c

* feat(go): add bucket_sort

* feat(c): add bucket_sort in c

* Update bucket_sort_test.go

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-03-30 02:00:17 +08:00
nuomi1
944c34982c
feat: add Swift codes for bucket_sort article (#444) 2023-03-30 01:59:14 +08:00
Yudong Jin
34a1bca627
Add the section of radix sort. (#441) 2023-03-26 22:02:37 +08:00
krahets
4830dffd26 Update the test case in bucket_sort.java 2023-03-26 04:50:59 +08:00
krahets
c338a6d8d8 Add the section of bucket sort 2023-03-26 04:47:05 +08:00
krahets
22898b6955 Simplify the contents of the sorting algorithms. 2023-03-25 18:41:22 +08:00
Guanngxu
9b0bdd929f
feat: add C merge sort (#434)
* feat: add C merge sort

* Update merge_sort.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-03-23 19:10:33 +08:00
krahets
0a4a846e13 Fix python modules 2023-03-23 18:56:14 +08:00
Yudong Jin
8918ec9079
refactor: Follow the PEP 585 Typing standard (#439)
* Follow the PEP 585 Typing standard

* Update list.py
2023-03-23 18:51:56 +08:00
nuomi1
31be65cc55
refactor: use stride (#437) 2023-03-23 02:57:31 +08:00
nuomi1
5ba85ea69d
feat: add Swift codes for counting_sort article (#438) 2023-03-23 02:57:13 +08:00
Yudong Jin
65e47b0748
Add Python and C++ code for the counting sort. (#436) 2023-03-21 22:24:17 +08:00
krahets
a78365401e Update counting_sort.go and radix_sort.go 2023-03-20 21:40:50 +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
Guanngxu
e539c44f63
feat: add C counting_sort (#430)
* feat: add C counting_sort

* Update CMakeLists.txt

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-03-20 21:25:03 +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
Reanon
c837882dbd
feat(counting_sort): support counting_sort in c/go (#431)
* feat(go/counting_sort): support counting_sort in go

* feat(test): support counting_sort_naive testcase

* feat(go/counting_sort): support counting sort

* feat(c/counting_sort): support counting_sort in c
2023-03-20 21:16:25 +08:00
Guanngxu
2356cc1b2e
add C binary_search and linear_search (#426)
* add C binary_search

* add C linear_search

* Update linear_search.c

* Update binary_search.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-03-20 19:17:20 +08:00
Gonglja
564ace6bc1
feat(codes/c): Add linkedlist_deque.c (#422)
* feat(codes/c): Add linkedlist_deque.c

* feat(codes/c): Update linkedlist_deque.c function comment.

* feat(codes/c): Update linkedlist_deque.c driver code.
2023-03-19 23:48:46 +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
Yudong Jin
ceeb138487
Add the section of counting sort. (#427) 2023-03-19 23:42:12 +08:00
krahets
3cd724a6d8 Update list_node.h 2023-03-18 18:33:35 +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
sjinzh
c2be6ebfbe
🚀feat: add rust codes for array_deque (#418)
* update zig codes style

* feat: add rust codes for array_deque

* Update array_deque.rs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-03-14 20:45:27 +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
krahets
b37a088f7d Fix a comment in binary_tree_bfs.go 2023-03-13 22:47:22 +08:00
krahets
516cb17775 Replace poll with pop 2023-03-13 22:39:45 +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
Gonglja
2d17ee8e92
feat(codes/c): Add array_deque.c (#412)
* feat(codes/c): Add array_deque.c

* Update array_deque.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-03-13 20:40:25 +08:00
Gonglja
f73b6a3654
feat(codes/c): Add linkedlist_queue.c (#413)
* feat(codes/c): Add linkedlist_queue.c

* feat(codes/c): Prevent null pointer access errors in linkedlist_queue.c

* Update linkedlist_queue.c

* Update linkedlist_queue.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-03-13 20:37:58 +08:00
Reanon
be0c965886
feat(go/deque): support go array deque (#414) 2023-03-13 20:16:23 +08:00
sjinzh
6924d15f63
🚀feat: add rust codes for linkedlist_stack, linkedlist_queue and linkedlist_deque (#410)
* feat: add rust codes for space_complexity

* feat: add rust codes for linkedlist_stack

* update

* feat: add rust codes for linkedlist_queue

* feat: add rust codes for linkedlist_deque

* update
2023-03-13 20:15:11 +08:00
Yudong Jin
9151eaf533
Add typing annotations to Python codes. (#411) 2023-03-12 18:49:52 +08:00
sjinzh
2029d2b939
feat: add rust codes for space_complexity (#409) 2023-03-12 15:16:35 +08:00
krahets
82bbdd444d Update the chapter of stack and queue. 2023-03-12 04:14:36 +08:00
sjinzh
050b922f8a
feat: add rust codes for linked_list and my_list (#408)
* feat: add rust codes for linked_list

* feat: add rust codes for my_list

* Update linked_list.rs

* Update print_util.rs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-03-12 02:48:44 +08:00