Commit graph

1213 commits

Author SHA1 Message Date
Yudong Jin
d5ee877fd8
feat: Add Docker for code debugging (#927)
* Update Dockerfile and docker-compose.yml

* Add Dockerfile for code debugging.
Add installation procedures of python, cpp and java.
2023-11-08 03:20:29 +08:00
krahets
5f3ad1ed3d A few bug fixes. 2023-11-03 22:48:43 +08:00
Yudong Jin
23cce00e09
Fix Python build check script. (#911)
* Fix Python build check script.

* Update python code check workflow

* Update python test script.

* Compatible with Python >=3.9

* Compatible with Python >=3.10

* Fix errors in Windows

* test

* Add Python version in installation.md

* Update test_all.py
2023-11-02 21:58:14 +08:00
krahets
355cc3a6b1 Bug fixes to C code. 2023-11-01 05:14:22 +08:00
Yudong Jin
9c28619839
feat: Reimplement the graph code for C (#901)
* Reimplement the graph code for C

* Free memory of **vertices.
2023-10-29 19:52:19 +08:00
krahets
db5d1d21f3 Several bug fixes. 2023-10-29 00:09:54 +08:00
Justin Tse
c37f0981f0
feat: refactor top_k.ts (#899) 2023-10-28 14:27:52 +08:00
lucas
f98b337144
refactor: Re-implement hanota.c (#885)
* feat: re-impl hanota.c

* chore: Remove useless comment code

* Update hanota.c

* Update hanota.c

* Update print_util.h

* Update CMakeLists.txt

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-27 23:41:58 +08:00
Yudong Jin
492a69ebca
refactor: Replace vector with array in C code (#894)
* Re-implement merge sort function.

* Replace vector with array for C.

* fix
2023-10-27 23:26:48 +08:00
krahets
5385057993 Replace "结点" with "节点". 2023-10-27 23:24:13 +08:00
nuomi1
7605cab160
feature(swift): Reimplement merge_sort and top_k (#898)
* feat: Add swift-collections

* fix: use heap

* refactor: merge

* fix: import HeapModule
2023-10-27 22:59:54 +08:00
liuyuxin
1ab83bd3ef
refactor(dart): Re-implement merge sort function (#896) 2023-10-27 16:00:26 +08:00
krahets
bd8cda325e A few improvements to the C code. 2023-10-27 01:13:36 +08:00
krahets
0e10274bb4 Update arrayToTree() and treeToArray() for C. 2023-10-27 01:04:17 +08:00
krahets
5b1a219b8b Fine-tune code and texts. 2023-10-27 01:01:21 +08:00
易春风
3628b40f44
refactor: re-implement the rust codes of merge sort (#891) 2023-10-26 22:24:02 +08:00
Yudong Jin
e441ee4e35
Re-implement merge sort function. (#888) 2023-10-26 02:56:33 +08:00
Yudong Jin
7822bf9cd4
feat: add top_k.c and refactor top_k.js (#889)
* Add top_k.c based on my_heap.c

* Improve the implementation of top_k.js

* Add a comment to top_k
2023-10-26 02:54:19 +08:00
liuyuxin
a8b2350705
feat(dart): Add build check for Dart (#886)
* feat(dart): Add build check for Dart

* feat(dart): Add dart analyze to check

* fix(dart): remove dart analyze

* feat(dart): Ignore unused variable and add dart analyze
2023-10-25 23:15:53 +08:00
Yudong Jin
d26e811e10
Several bug fixes and improvements. (#887)
* fix the bugs of C code.

* Add a header figure.

* Improve the definition of tree node height.
2023-10-25 22:59:25 +08:00
52coder
436b6fa9a6
Add C++ iterator example for C++ (#837)
* 增加c++迭代器访问示例

* Update hash_map.md

* Update hash_map.cpp

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-24 23:59:10 +08:00
Spark
2035aa0cf1
feat: iteration & recursion in Zig (#804)
* iteration & recursion in Zig

* missing part in time_complexity.md (zig)

* build.zig sync

* Update recursion.zig

* Update iteration.zig

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-24 23:49:13 +08:00
Yudong Jin
19023148ba
feat: Update the implementation of hash_map_open_addressing.js and .ts (#881)
* add permutations_ii.c and re-implement permutations_i.c

* Update the implementation of hash_map_open_addressing.js and .ts

* Update hash_map_open_addressing.js

* Update hash_map_open_addressing.js
2023-10-24 23:46:34 +08:00
hpstory
fb3ce050c1
feat(csharp): add .net building and testing workflow, solution file (#879) 2023-10-24 17:13:29 +08:00
krahets
17252b53a9 Format code and docs. 2023-10-24 16:19:29 +08:00
Reese Wellin
88a1e4aaac
refactor(JS, TS): Improve code readability in edit_distance (#860)
* fix(JS、TS): chapter_sorting QuickSortMedian and QuickSortTailCall example

* refactor(JS、TS): Improve code readability in edit_distance

* Updated code
2023-10-24 15:32:20 +08:00
krahets
d27890d98d Fix automating build workflow for Python 2023-10-23 16:06:33 +08:00
krahets
b7c110e5ec Add build check with py_compile 2023-10-23 06:02:34 +08:00
sjinzh
0c470d19c8
upate build.zig (#874) 2023-10-23 03:20:16 +08:00
krahets
5aacf2dfe0 Improve Python code for importing modules. 2023-10-19 16:21:51 +08:00
krahets
1e49574332 Simplify struct declarations of C.
Use PascalCase for all structs in C.
SImplify n_queens.c
Format C code for chapter of graph.
2023-10-18 02:16:26 +08:00
krahets
5392afd44b fix several bugs 2023-10-17 23:45:31 +08:00
Yudong Jin
51405c0669
add permutations_ii.c and re-implement permutations_i.c (#868) 2023-10-17 10:20:10 -05:00
lucas
37872726b0
feat: build_tree.c translation (#847)
* feat: build_tree.c translation

* Update CMakeLists.txt

* chore: find with map

* change inordermap

* Update build_tree.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-17 08:47:16 -05:00
Yudong Jin
ea7275ab6a
add forLoopRecur in recursion.c (#866) 2023-10-17 07:28:17 -05:00
krahets
346c8451de Fix code naming style. 2023-10-15 21:18:09 +08:00
krahets
ada37fd1f8 Fix Python code. 2023-10-14 22:15:02 +08:00
krahets
2976d9ff56 Fix Python code. 2023-10-14 21:54:47 +08:00
krahets
a8c624fa5a Fix the code in min_path_sum 2023-10-14 03:25:11 +08:00
Yudong Jin
3df5c36370
refactor: Improve the hash_map_chaining.c implementation. (#858)
* Improve the hash_map_chaining.c implementation.

* Update hash_map_chaining.c
2023-10-13 02:04:45 -05:00
krahets
84e2799f1b Fix hash_map_chaining.c and
hash_map_open_addressing.c
2023-10-13 14:32:49 +08:00
lclc6
fe01f77ff8
Create hash_map_open_addressing.c (#838)
* Create hash_map_open_addressing.c

哈希冲突-C语言

* Update hash_map_open_addressing.c

* Update hash_map_open_addressing.c

* Update hash_map_open_addressing.c
2023-10-13 01:15:23 -05:00
FreddieLi
61eca92055
fix get() in hash_map_chaining.c (#845)
Fix get function.
2023-10-13 01:09:06 -05:00
krahets
da5ef293d9 fix a typo 2023-10-11 17:39:56 +08:00
krahets
c37b7c807b Several bug fixes 2023-10-09 18:21:18 +08:00
krahets
fb552987f5 Update variable names in list and my_list 2023-10-09 18:20:42 +08:00
lucas
704b638d89
feat: n_queens.c translation (#774)
* feat: tranlating n_queens.c

* Reference to c++ code with additional comments

* Update n_queens.c

* Update n_queens.c

* Format n_queens.c

* Update n_queens.c

keep  the file header information format consistent with others

* fine tune

* fine tune

* Delete mkdocs-en.yml

* Update README.md

---------

Co-authored-by: krahets <krahets@163.com>
2023-10-08 12:42:32 -05:00
hpstory
e03022d5fb
fix: Polishing code format on linearLogRecur, convert String type to string (#841) 2023-10-08 07:33:30 -05:00
王作勋
2bba70fd87
Add Edit distance in C code (#835)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Update vector.h

* Create binary_search_recur.c

* Delete codes/chapter_divide_and_conquer directory

* Update vector.h

* old vector.h

* Create edit_distance.c

* Update edit_distance.c

* Update edit_distance.c

* Update edit_distance.c

* Create CMakeLists.txt

* Update edit_distance.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-07 22:29:44 -05:00
王作勋
1a3b819355
Add Climbing stairs constraint dp in C code (#829)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Update vector.h

* Create binary_search_recur.c

* Delete codes/chapter_divide_and_conquer directory

* Update vector.h

* Create climbing_stairs_constraint_dp.c

* RollBack vector.h

* Create CMakeLists.txt

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-07 22:28:23 -05:00
krahets
51dab9dd25 Update overrides directory structure. 2023-10-08 04:42:57 +08:00
hpstory
f62256bee1
fix(csharp): Modify method name to PascalCase, simplify new expression (#840)
* Modify method name to PascalCase(array and linked list)

* Modify method name to PascalCase(backtracking)

* Modify method name to PascalCase(computational complexity)

* Modify method name to PascalCase(divide and conquer)

* Modify method name to PascalCase(dynamic programming)

* Modify method name to PascalCase(graph)

* Modify method name to PascalCase(greedy)

* Modify method name to PascalCase(hashing)

* Modify method name to PascalCase(heap)

* Modify method name to PascalCase(searching)

* Modify method name to PascalCase(sorting)

* Modify method name to PascalCase(stack and queue)

* Modify method name to PascalCase(tree)

* local check
2023-10-07 12:33:46 -05:00
47
70cff2d99f
fix: Fixed the state transition error in minCostClimbingStairsDP function (#839)
Signed-off-by: foursevenlove <foursevenlove@gmail.com>
2023-10-07 08:52:12 -05:00
Nepenthe
61e1d1faec
feat(go): add forLoopRecur func (#816) 2023-10-07 08:47:58 -05:00
王作勋
ef87bd494a
Add Binary search recur in C code (#820)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Update vector.h

* Create binary_search_recur.c

* Create CMakeLists.txt

* Update vector.h

* RollBack vector.h

* Update CMakeLists.txt

* Update binary_search_recur.c

* Update binary_search_recur.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-07 08:47:05 -05:00
王作勋
2b59c9ce88
Add Coin change ii in C code (#834)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Update vector.h

* Create binary_search_recur.c

* Delete codes/chapter_divide_and_conquer directory

* Update vector.h

* old vector.h

* Create coin_change_ii.c

* Update coin_change_ii.c

* Create CMakeLists.txt

* Update coin_change_ii.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-07 08:41:09 -05:00
王作勋
8b4d3300c3
Add Coin change in C code (#833)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Update vector.h

* Create binary_search_recur.c

* Delete codes/chapter_divide_and_conquer directory

* Update vector.h

* old vector.h

* Create coin_change.c

* Update coin_change.c

* Update coin_change.c

* Create CMakeLists.txt

* Update coin_change.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-07 08:40:17 -05:00
王作勋
d75a2eb691
Add Unbounded knapsack in C code (#832)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Update vector.h

* Create binary_search_recur.c

* Delete codes/chapter_divide_and_conquer directory

* Update vector.h

* old vector.h

* Create unbounded_knapsack.c

* Update unbounded_knapsack.c

* Update unbounded_knapsack.c

* Create CMakeLists.txt

* Update unbounded_knapsack.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-07 08:38:02 -05:00
王作勋
1364bc52e7
Add Min path sum in C code (#831)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Update vector.h

* Create binary_search_recur.c

* Delete codes/chapter_divide_and_conquer directory

* Update vector.h

* old vector.h

* Create min_path_sum.c

* Update min_path_sum.c

* Update min_path_sum.c

* Create CMakeLists.txt

* Update min_path_sum.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-07 08:36:52 -05:00
王作勋
946853431f
Add Knapsack in C code (#830)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Update vector.h

* Create binary_search_recur.c

* Delete codes/chapter_divide_and_conquer directory

* Update vector.h

* old vector.h

* Create knapsack.c

* Update knapsack.c

* Update knapsack.c

* Create CMakeLists.txt

* Update knapsack.c

* Update knapsack.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-07 08:33:41 -05:00
王作勋
c6bc10a101
Add Min cost climbing stairs dp in C code (#828)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Update vector.h

* Create binary_search_recur.c

* Delete codes/chapter_divide_and_conquer directory

* Update vector.h

* Create min_cost_climbing_stairs_dp.c

* Update min_cost_climbing_stairs_dp.c

* Update min_cost_climbing_stairs_dp.c

* RollBack vector.h

* Update min_cost_climbing_stairs_dp.c

* Update min_cost_climbing_stairs_dp.c

* Create CMakeLists.txt

* Update min_cost_climbing_stairs_dp.c
2023-10-07 08:32:35 -05:00
王作勋
21fa72ea9f
Add hanota in C code (#819)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Create hanota.c

* Update vector.h

* Update hanota.c

* Create CMakeLists.txt

* Update vector.h

* Update hanota.c

* RollBack vector.h

* Update CMakeLists.txt

* Update hanota.c

* Update hanota.c
2023-10-07 08:30:12 -05:00
王作勋
1f512b105f
refactor: Extend vector.h implementation (#818)
* Update vector.h

增加功能列表:
获取向量的第 i 个元素
设置向量的第 i 个元素
向量扩容
向量缩容
向量插入元素
向量删除元素
向量交换元素
向量是否为空
向量是否已满
向量是否相等
对向量内部进行排序(升序/降序)
对向量某段数据排序(升序/降序)

* Create hanota.c

* 新增binary_search_recur.c

* Update vector.h

* Delete codes/c/chapter_divide_and_conquer directory

* Update vector.h

* Create binary_search_recur.c

* Delete codes/chapter_divide_and_conquer directory

* Update vector.h

* Update vector.h
2023-10-07 00:43:30 -05:00
krahets
4355f8d49f Several bug fixes. 2023-10-04 02:30:31 +08:00
krahets
98538b924f Several bugs fixes and improvments; 2023-10-01 19:33:53 +08:00
易春风
e8bf5879b0
fix: the rust variable should have a snake case name (#811) 2023-09-29 08:37:02 -05:00
易春风
5b692968a9
feat: add for-loop-recur rust codes (#803) 2023-09-28 23:17:05 -05:00
花无缺
191330e73a
feat: Add C code for the section of intro to DP (#771)
* Add dynamic programming C language code

* Add dynamic programming chapter C language code

* Modifying errors in files
2023-09-25 22:11:08 -05:00
Flamingo
22be495412
fix(cpp). update hash_map (#800)
* fix(cpp). update hash_map

遍历 map 还是 k-v 键值对

* Update hash_map.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-25 22:07:14 -05:00
liuyuxin
e3366363b6
feat(dart): add forLoopRecur and update HashMapOpenAddressing (#802)
* feat(dart): add forLoopRecur

* feat(dart): update HashMapOpenAddressing
2023-09-25 22:04:13 -05:00
krahets
e567d08348 Bug fixes 2023-09-26 10:57:53 +08:00
nuomi1
72f243eec3
feat(Swift): update min_cost_climbing_stairs_dp and hash_map_open_addressing (#792) 2023-09-24 09:50:09 -05:00
krahets
ff8e7ceec5 Several bug fixes. 2023-09-24 20:38:21 +08:00
krahets
e3773b7f76 Several bug fixes and improments. 2023-09-24 19:35:32 +08:00
jmin
26bf0c5a78
feat: Add javascript and typescript code in chapter_computational_com… (#780)
* feat: Add javascript and typescript code in chapter_computational_complexity

* docs: Update code comment

* style: update code order th same with java
2023-09-24 03:17:19 -05:00
易春风
4b5e21d0d9
refactor: update the hash_map_open_addressing rust codes to synchronize with java (#787) 2023-09-24 03:16:06 -05:00
Reese Wellin
a6a1036dc9
fix(JS, TS): chapter_sorting QuickSortMedian and QuickSortTailCall example (#785) 2023-09-24 03:14:28 -05:00
hpstory
29c5ff4a8f
feat(csharp): add forLoopRecur and new HashMapOpenAddressing (#783) 2023-09-23 14:15:23 -05:00
Justin Tse
2f727d895d
Fix JS and TS sort bugs (#784) 2023-09-23 14:14:44 -05:00
krahets
1067f30fe7 Include glightbox plugin enabling zooming figures 2023-09-22 13:08:21 +08:00
xianii
d225b416cf
feat: add C code in chapter_greedy (#755)
* add fractional_knapsack.c

* update CMakeLists

* add c code in chapter_greedy

* fix header format

* format code by clang-format

* remove extra comments

* replace ternary operator to MACRO

* parameters form adjustment

* Update fractional_knapsack.c

* Update max_capacity.c

* Update max_product_cutting.c

* add comments for consistency with cpp ver

* move MIN&MAX macro to source file

* typo fix

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-21 07:52:11 -05:00
Yudong Jin
a46b482951
Refactor the hash_map_open_addressing implementation with lazy reallocation. (#776) 2023-09-21 04:43:15 -05:00
lyl625760
45e20e57a1
fix: Update hash_map_open_addressing.java (#727)
* FixBug:Update hash_map_open_addressing.java

1. put keyA, hashFunc 在位置 5
2 put key B, hashFunc 在位置  5. 和 A冲突,插入位置6
3. remove keyA,位置5removed
4. put keyB, hashFunc 在位置  5. 没有冲突,插入位置5
5. remove keyB, 位置5removed
6. get keyB, 此时会出bug,会访问到位置6. 实际上应为keyB 已经删除了

* Update hash_map_open_addressing.java

* Update hash_map_open_addressing.java

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-21 04:39:21 -05:00
krahets
8effa58a59 Several bug fixes. 2023-09-20 01:53:44 +08:00
gonglja
53d91db10d
Fix unreleased memory error (#769)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* fix(codes/c): Fix space_complexity.c build error.

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

* feat(code/c): Update push_back and pop_back in vector.h

* styles(codes/c): Adjust  format.

* feat(codes/c): Add `interation.c ` `recursion.c` `simple_hash.c` `binary_search_edge.c` `binary_search_insertion.c` in C codes.

* fix(mylist.c): Fix `insert` function in `mylist.c`

https://github.com/krahets/hello-algo/discussions/32#discussioncomment-6974163

* fix(array.c): Fix unreleased memory error

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-19 23:53:45 +08:00
gonglja
bd740b0466
Fix linkedlist queue print error (#770)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* fix(codes/c): Fix space_complexity.c build error.

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

* feat(code/c): Update push_back and pop_back in vector.h

* styles(codes/c): Adjust  format.

* feat(codes/c): Add `interation.c ` `recursion.c` `simple_hash.c` `binary_search_edge.c` `binary_search_insertion.c` in C codes.

* fix(mylist.c): Fix `insert` function in `mylist.c`

https://github.com/krahets/hello-algo/discussions/32#discussioncomment-6974163

* fix(linkedlist_queue.c): Fix linkedlist_queue.c print error

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-19 23:53:01 +08:00
krahets
9f59c572b5 fine tune 2023-09-17 01:13:15 +08:00
krahets
cb9c14f5ff fix build_tree, binary_search_tree.cs
fix two figures
2023-09-15 02:08:09 +08:00
xianii
af2aeb0897
Remove duplication in cmake (#756)
* remove duplication in cmakelists

* Update CMakeLists.txt

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-14 03:39:22 +08:00
krahets
d190dbf3c1 Several enhancements and fixes 2023-09-14 03:36:31 +08:00
malone6
a9d70e9e4b
fix: raise error in peek() function of linkedlist_stack.py, linkedlist_queue.py, linkedlist_deque.py (#754)
* fix: linkedlist_stack.py 中的peek方法需要判空raise Error

栈空的时候不能再 peek() 。另外由于 pop() 复用了 peek() ,栈空时返回的 None 会传递到 pop() 中的 num ,导致后续的继续执行 
 self.peek.next 报错等后续问题

* Update linkedlist_stack.py

* Update linkedlist_queue.py

* Update linkedlist_deque.py

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-14 01:22:53 +08:00
MwumLi
01732cc14f
feat: add c codes for iteration (#735)
Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-13 03:13:55 +08:00
malone6
9b8625d741
Sync the while loop in iteration.cs with other languages (#746) 2023-09-13 03:06:40 +08:00
keshida
d5bac12f60
fix: modify a function name in array_stack.js(ts) and array_queue.js(ts) (#739)
* Update array_stack.js

判空函数名称有歧义

* Update array_stack.js

* Update array_queue.js

* Update array_stack.ts

* Update array_queue.ts

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-13 03:00:39 +08:00
gonglja
4a923f5a86
Fix insert function in mylist.c (#747)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* fix(codes/c): Fix space_complexity.c build error.

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

* feat(code/c): Update push_back and pop_back in vector.h

* styles(codes/c): Adjust  format.

* feat(codes/c): Add `interation.c ` `recursion.c` `simple_hash.c` `binary_search_edge.c` `binary_search_insertion.c` in C codes.

* fix(mylist.c): Fix `insert` function in `mylist.c`

https://github.com/krahets/hello-algo/discussions/32#discussioncomment-6974163

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-13 02:50:43 +08:00
krahets
5f814d6538 Add comparison between iteration and recursion.
Fix the figure of tail recursion.
Fix two links.
2023-09-12 00:56:59 +08:00
krahets
2b54352bec prepare 1.0.0b5 release 2023-09-10 23:11:50 +08:00
gonglja
63efe61e56
Add interation.c recursion.c simple_hash.c binary_search_edge.c binary_search_insertion.c in C codes. (#731)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* fix(codes/c): Fix space_complexity.c build error.

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

* feat(code/c): Update push_back and pop_back in vector.h

* styles(codes/c): Adjust  format.

* feat(codes/c): Add `interation.c ` `recursion.c` `simple_hash.c` `binary_search_edge.c` `binary_search_insertion.c` in C codes.

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-09 19:16:15 +08:00
gonglja
fb301b5767
Fix print error (#729)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* fix(codes/c): Fix space_complexity.c build error.

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

* feat(code/c): Update push_back and pop_back in vector.h

* styles(codes/c): Adjust  format.

* fix(codes/cpp/chapter_greedy): Fix print error.

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-09 16:42:33 +08:00
gonglja
46d6463883
Remove unnecessary printing (#733)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* fix(codes/c): Fix space_complexity.c build error.

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

* feat(code/c): Update push_back and pop_back in vector.h

* styles(codes/c): Adjust  format.

* style: Remove unnecessary print.

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-09 16:42:04 +08:00
gonglja
7483c6ce1e
Fix my_heap.c build error (#732)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* fix(codes/c): Fix space_complexity.c build error.

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

* feat(code/c): Update push_back and pop_back in vector.h

* styles(codes/c): Adjust  format.

* fix(codes/c/chapter_heap): Fix my_head.c build error.

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-09 16:41:24 +08:00
linweibin
c8e0c476bd
增加C的贪心算法代码 (#726) 2023-09-09 16:28:44 +08:00
krahets
f71b2a40da fix preorder_traversal_iii_compact code 2023-09-09 00:51:00 +08:00
Night Cruising
2217ffc447
feat: add rust codes for simple_hash (#724) 2023-09-08 00:38:55 +08:00
XiaChuerwu
180d4982c9
feat: Add C codes for chapter_hashing (#706)
* feat: Add C codes for chapter_hashing

* fix:Make corrections to the formatting

* fix:Fixing Test Cases

* fix:Fixing Test Cases

* fix:revised format

* Update hash_map_chaining.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-08 00:36:49 +08:00
Yudong Jin
9c3b7b6422
Sort the coding languages by applications. (#721) 2023-09-04 03:19:08 +08:00
nuomi1
8d5e84f70a
Feature/chapter greedy swift (#720)
* feat: add Swift codes for greedy_algorithm article

* feat: add Swift codes for fractional_knapsack_problem article

* feat: add Swift codes for max_capacity_problem article

* feat: add Swift codes for max_product_cutting_problem article
2023-09-03 19:09:45 +08:00
krahets
dd72335235 Format C, C++, C#, Go, Java, Python, Rust code. 2023-09-02 23:54:38 +08:00
nuomi1
b6ac6aa7d7
Feature/chapter divide and conquer swift (#719)
* feat: add Swift codes for binary_search_recur article

* feat: add Swift codes for build_binary_tree_problem article

* feat: add Swift codes for hanota_problem article
2023-09-02 23:08:37 +08:00
krahets
978857570f Format JS and TS code. 2023-09-02 23:07:47 +08:00
Justin Tse
f96f583771
Add Chapter greedy for JS and TS code (#718)
* Fix binary_search_tree TS code

* Update binary_search_tree js code style

* Add the JavaScript code for Chapter of Greedy

* Add the TypeScript code for Chapter of Greedy

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-02 20:20:17 +08:00
Justin Tse
89a5f4d0d7
Fix binary_search_tree TS code and update JS code style (#715)
* Fix binary_search_tree TS code

* Update binary_search_tree js code style

* Update binary_search_tree.ts

* Update avl_tree.ts

* Update binary_search_tree.ts

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-02 19:56:23 +08:00
nuomi1
22d1135e04
refactor: remove buildTree (#716) 2023-09-02 19:47:54 +08:00
nuomi1
fd84d4443e
feat: add Swift codes for iteration_and_recursion article (#717) 2023-09-02 19:47:18 +08:00
gaofer
620bfb1f1d
Iteration and recursion code in js/ts (#703)
* feat(JS and TS):add the section of iteration and recursion

* feat(JS and TS):add the section of iteration and recursion

* feat(JS and TS):add the section of iteration and recursion
2023-09-02 16:09:13 +08:00
Night Cruising
3af00d00d7
feat: add rust codes for chapter computational complexity (#714) 2023-09-02 16:08:52 +08:00
hpstory
8a0a8b80cf
feat(csharp): fix binary_search_tree code (#712)
* feat(csharp): fix binary_search_tree code

* Update binary_search_tree.cs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-08-31 16:59:43 +08:00
liuyuxin
233e842d63
fix dart code for binary_search_tree (#711) 2023-08-31 16:55:16 +08:00
Night Cruising
95bc0ffdb2
Feat: add rust codes for chapter searching (#710) 2023-08-31 02:36:06 +08:00
Night Cruising
d37b795ef2
Fix the bug of wrong function call (#709) 2023-08-31 02:33:13 +08:00
krahets
a47a974a6a fix climbing_stairs_constraint_dp code 2023-08-31 02:31:58 +08:00
krahets
628d8a516b fix binary_search_tree code 2023-08-31 02:31:31 +08:00
gaofer
f7ab4797bf
feat: add dynamic programming code for JS and TS (#692)
* fix: Correcting typos

* Add JavaScript and TypeScript code of dynamic programming.

* fix: Code Style

* Change ==/!= to ===/!==
* Create const by default, change to let if necessary.

* style fix: Delete unnecessary defined type
2023-08-30 15:27:01 +08:00
krahets
63aef4ed08 Fix a figure and latex symbols. 2023-08-30 15:25:03 +08:00
gaofer
1b94b77cbb
Add code in javascript and typescript. (#690)
* Add binary_search_insertion and binary_search_edge code in javascript and typescript.

* code style fix: in FOR loop, use CONST will be nicer.

* fix: Code Style

* Change ==/!= to ===/!==
* Create const by default, change to let if necessary.
* Update import files

* Update codes/javascript/chapter_searching/binary_search_edge.js

Co-authored-by: Justin Tse <xiefahit@gmail.com>

* style fix: Delete unnecessary defined type

---------

Co-authored-by: Justin Tse <xiefahit@gmail.com>
2023-08-30 05:21:47 +08:00
XiaChuerwu
cf0d4b32ec
Added destructor function (#702)
* Added destructor function

* Fixed hash function

* Added hash_map_chaining.c file

* Amendment submission

* Delete hash_map_chaining.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-08-29 20:24:42 +08:00
hpstory
8528ae224e
feat(csharp): add the section of iteration and recursion (#697) 2023-08-28 13:36:41 +08:00
Reanon
20f53e9fc4
feat(go): add iterration/recursion & fix bugs (#698) 2023-08-28 13:35:39 +08:00
liuyuxin
50e17905fd
feat: Add Dart Codes for section_iteration_and_recursion (#696) 2023-08-28 00:50:26 +08:00
krahets
9731a46d67 Fix a definition. 2023-08-27 00:50:18 +08:00
krahets
ae304bd605 Update iteration code. 2023-08-25 02:22:57 +08:00
Yudong Jin
3e64f68ae9
Add the section of iteration and recursion. (#693) 2023-08-24 17:51:41 +08:00
krahets
f524b957d4 Finetune and fix 2023-08-24 17:48:35 +08:00
Reanon
628a274b50
feat(go): support binary search & fix comments (#691) 2023-08-23 21:32:40 +08:00
krahets
f5dda8d99a Polish the content 2023-08-21 03:06:53 +08:00
krahets
2626de8d0b Polish the chapter
introduction, computational complexity.
2023-08-20 14:51:39 +08:00
krahets
c310edb672 Polish the chapter of array and linkedlist 2023-08-17 05:13:19 +08:00
liuyuxin
0858ab91c0
Add missing Dart codes and fix some errors (#689)
* Add missing Dart codes and fix some errors

* Update array_binary_tree.dart

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-08-17 05:04:38 +08:00
Justin Tse
5d7e0a59b1
Add JavaScript and TypeScript code of top_k and update some code style (#686)
* Update JS and TS code style

* Add JavaScript and TypeScript code of top_k

* Update top_k.ts

* Apply suggestions from code review

Co-authored-by: Justin Tse <xiefahit@gmail.com>

* Apply suggestions from code review

Co-authored-by: Justin Tse <xiefahit@gmail.com>

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-08-17 05:00:35 +08:00
liuyuxin
4c75c204f3
feat: Add Dart codes for binary search (#688) 2023-08-14 23:07:20 +08:00
Night Cruising
5a4182372c
Fix the bug of index in rust codes (#685) 2023-08-14 00:54:15 +08:00
krahets
0c18198c01 Fix the figures.
Polish the chapter of data structure.
2023-08-13 19:32:11 +08:00
William Yuan
ec82be7dc2
feat(tree): Add the array representation of the binary tree(js,ts) (#681)
* fix: fixed the bug of arrToTree function

* feat(tree): Add the array representation of the binary tree(js,ts)

* refactor: Make the arrToTree method match the method in java
2023-08-13 19:30:50 +08:00
liuyuxin
10c397b172
feat: Add Dart codes for chapter_dynamic_programming and chapter_greedy (#683)
* feat: Add Dart codes for chapter_dynamic_programming

* feat: Add Dart codes for chapter_greedy
2023-08-13 19:29:54 +08:00
liuyuxin
4325974af1
feat: Add Dart codes for chapter_backtracking and chapter_divide_and_conquer (#680)
* feat: Add Dart codes for chapter_backtracking

* feat: Add Dart codes for chapter_divide_and_conquer

* Format Dart Code
2023-08-10 23:48:56 +08:00
William Yuan
e97eee0e18
feat(chapter_hashing): Add js and ts codes for chapter hashing (#675)
* refactor(chapter_hashing): Remove unnecessary chaining operator

* feat(chapter_hashing): Add js and ts codes for chapter 6

* refactor(chapter_hashing): Optimize the remove function logic

* refactor(chapter_hashing): Remove unnecessary chaining operator

* refactor(chapter_hashing): use const instead of let
2023-08-10 23:04:41 +08:00
krahets
6ef4dc6444 Fix the content 2023-08-10 11:35:16 +08:00
krahets
932d14644d Polish the content
Polish the chapter preface, introduction and complexity anlysis
2023-08-08 23:16:33 +08:00
krahets
4bc6b8af7b finetune 2023-08-06 23:19:37 +08:00
hpstory
c14ca74b8b
feat(csharp): add binary search csharp codes (#676) 2023-08-06 23:16:02 +08:00
nuomi1
fceea4bbda
Feature/chapter searching swift (#673)
* fix: remove binary_search_edge

* feat: add Swift codes for binary_search_insertion article

* feat: add Swift codes for binary_search_edge article
2023-08-06 23:09:32 +08:00
krahets
08e4924054 Finetune 2023-08-04 05:25:22 +08:00
Yudong Jin
71074d88f6
Add the section of binary search insertion. (#671)
Refactor the section of binary search edge.
Finetune the figures of binary search.
2023-08-04 05:16:56 +08:00
gonglja
9900e0c668
Add array_binary_tree.c and update push_back and pop_back in vector.h (#664)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* fix(codes/c): Fix space_complexity.c build error.

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

* feat(code/c): Update push_back and pop_back in vector.h

* styles(codes/c): Adjust  format.

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-08-03 14:48:10 +08:00
William Yuan
70784a1ec3
feat(chapter_backtracking): Add js and ts codes for chapter 13.3 (#667)
* feat(chapter_dynamic_programming): Add js and ts codes for chapter 14.1

* style(chapter_dynamic_programming): format code

* refactor(chapter_dynamic_programming): remove main definition and add type

* feat(chapter_backtracking): Add js and ts codes for chapter 13.3

* feat(chapter_divide_and_conquer): Add js and ts codes for chapter 12.2

* feat(chapter_divide_and_conquer): Add js and ts codes for chapter 12.3

* feat(chapter_divide_and_conquer): Add js and ts codes for chapter 12.4

* style(chapter_divide_and_conquer): fix typo

* refactor: Use === instead of == in js and ts
2023-08-03 14:44:49 +08:00
krahets
6da6d24193 Fix the code of hash map chaining. 2023-08-01 17:05:40 +08:00
nuomi1
a54ec55516
fix: break reference cycling (#666) 2023-07-31 03:32:19 +08:00
krahets
dbe3b4d6ba Fine tune. 2023-07-31 03:27:26 +08:00
gonglja
f7b827b303
Fix space_complexity.c build error. (#663)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* fix(codes/c): Fix space_complexity.c build error.

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-29 18:21:47 +08:00
gonglja
8f5ef68c65
feat: Add C codes for the chapter backtracking (#593)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* feat(codes/c): Add part of the c code in the backtracking chapter

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

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

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

* style(codes/c): Adjust the format

* feat(codes/c): Add memory release in chapter_backtracking

* fix(codes/c): Fix memory release issue.

* style(codes/c): Update format and Merge duplicate code

* style(code/c): Change print format in preorder_traversal_iii_template.c

* Update preorder_traversal_iii_template.c

* Update permutations_i.c

* feat(codes/c): Remove myArray, use public vector.

* feat(codes/c): Add subset_sum_i_naive.c in C codes.

* feat(codes/c): Add permutations_i in CMakeLists.txt

* feat(codes/c): Update printf function in vector.h.

* feat(codes/c): Add subset_sum_i.c and subset_sum_ii.c

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-29 15:14:01 +08:00
yishangzhang
fc63e990c8
fix: Object pointer not deleted (#662)
* fix: Object pointer not deleted

*  codes/cpp/chapter_hashing

Signed-off-by: yishangzhang <zhangyi2017@cug.edu.cn>

* Update hash_map_chaining.cpp

---------

Signed-off-by: yishangzhang <zhangyi2017@cug.edu.cn>
Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-29 02:08:00 +08:00
William Yuan
35e9c8c209
feat(chapter_dynamic_programming): Add js and ts codes for chapter 14.1 (#658)
* feat(chapter_dynamic_programming): Add js and ts codes for chapter 14.1

* style(chapter_dynamic_programming): format code

* refactor(chapter_dynamic_programming): remove main definition and add type
2023-07-29 02:06:11 +08:00
WangSL
13bb76c283
feat: add rust code for build_in_hash and hash_collision (#629)
* Create hash_map_chaining.rs

* Create hash_map_open_addressing.rs

* Create build_in_hash.rs

* Update Cargo.toml
2023-07-26 15:42:47 +08:00
Reanon
575bcf58ef
feat(go/tree): support array binary tree (#655) 2023-07-26 11:04:09 +08:00
Yudong Jin
027bdd6510
Release Rust code to documents. (#656) 2023-07-26 11:00:53 +08:00
krahets
60162f6fa8 Finetune Rust code. 2023-07-26 10:01:49 +08:00
Night Cruising
06006c58a2
feat: add rust codes for array binary tree (#654)
* feat: add rust codes for array binary tree

* update tree_node.rs

* update: add implementation of vec_to_tree and tree_to_vec

* update tree_node.rs

* Update tree_node.rs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-26 09:15:58 +08:00
krahets
35973068a7 Prepare for release 1.0.0b4 2023-07-26 03:15:49 +08:00
krahets
b067016bfa Update preorder_traversal_iii. 2023-07-25 16:39:38 +08:00
krahets
90af225dae Remove -> None for Python functions 2023-07-24 22:34:05 +08:00
gonglja
ac0f405f9a
Fix quadraticRecur bug in space_complexity.c (#651)
* 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.

* feat: Add preorder_traversal_i_compact.c

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

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

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

* fix(codes/c): Add programs that are not managed by cmake (c code)

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

* style(codes/c): Change swap in selection_sort.c to `selectionSort`

* styles(codes/c): Change style.

* fix(codes/c): Fix some formatting errors and temporarily remove backtracking chapters

* fix(codes/c): Fix quadraticRecur bug in `space_complexity.c`

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-24 22:29:13 +08:00
Night Cruising
fdbe275fc9
fix: check the rust codes and fix them (#653)
* fix: check the rust codes and fix it

* Update binary_tree_bfs.rs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-24 22:27:26 +08:00
hpstory
978d3c2ed7
fix(csharp): reformat csharp codes and docs (#652)
* fix(csharp): reformat the C# codes and docs

* Update time_complexity.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-24 19:50:00 +08:00
krahets
1777a16865 Fix Go comment and link 2023-07-24 13:11:00 +08:00
nuomi1
9ab4b0b15c
Feature/array representation of tree swift (#649)
* refactor: encode & decode Tree

* style: build warning

* feat: add Swift codes for array_representation_of_tree article
2023-07-24 12:46:48 +08:00
Reanon
c1adeb2399
feat(go/dp): support dynamic programming (#622)
* feat(go/dp): support climbing stairs

* feat(go/dp): support knapsack

* feat(go/dp): coin_change & edit_distance
2023-07-24 03:08:35 +08:00
Reanon
10e5e7499b
feat(go/greedy): add greedy in go code (#648) 2023-07-24 03:06:47 +08:00
Night Cruising
41db3701ab
Update max_product_cutting.java (#647) 2023-07-24 03:05:57 +08:00
Night Cruising
9d56622c75
feat: add rust codes for chapter greedy (#646)
* feat: add rust codes for chapter greedy

* Update max_product_cutting.rs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-22 20:35:57 +08:00
hpstory
b43de88f71
feat(csharp): add csharp code for charper greedy (#645) 2023-07-22 02:54:41 +08:00
Hongyun Zhang
eb695937a4
Add divide and conquer go code (#638)
* feat: Add Go code to binary search recursion under divide and conquer

* style: Code comment standardization

* style: modify function comment

* fix: fixed error when the list is empty

* Update print_utils.go

* Delete print_utils_test.go

* feat: add Go code to divide and conquer

* Update build_tree.go

* style: modify function name

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-21 22:16:42 +08:00
krahets
bba62bbe75 Fix the code of preorder_traversal_iii_compact 2023-07-21 22:08:26 +08:00
Yudong Jin
075c3abf88
Add the section of max product cutting problem. (#642) 2023-07-21 21:56:14 +08:00
krahets
1a55dbdf2e Finetune doc and code. 2023-07-21 15:18:01 +08:00
Yudong Jin
76f11ae168
Add the section of max capacity problem. (#639) 2023-07-21 15:16:51 +08:00
Hongyun Zhang
8068c42688
fixed error when the list is empty (#637)
* feat: Add Go code to binary search recursion under divide and conquer

* style: Code comment standardization

* style: modify function comment

* fix: fixed error when the list is empty

* Update print_utils.go

* Delete print_utils_test.go

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-21 14:47:37 +08:00
NI-SW
da2c71d936
add c code for graph operation (#601)
* Create chapter_graph

* Delete chapter_graph

* add C code for graph

* add C code for graph

* Create graph_adjacency_list.c

add C code for graph

* Update CMakeLists.txt

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update format and output

* Update graph_adjacency_list.c

* Update CMakeLists.txt for c code of graph

* Update format of c code

* Update format of c code

* Update format of c code

* Update verticesList

Change the data structure of the storage list from a linked list to a linear table

* Update graph_adjacency_list.c

* Update graph_adjacency_matrix.c

* Create graph_adjacency_list_test.c

* Create graph_bfs

* Update CMakeLists.txt

* Update graph_adjacency_list.c

* mv graph_bfs to graph_bfs.c

* Update graph_bfs.c

* Delete graph_bfs

* Update graph_adjacency_list.c

* update c code for graph operation.

* Update CMakeLists.txt

* Update graph_dfs.c

* Update graph_dfs.c

* Update CMakeLists.txt

* Update graph_dfs.c

* Update note of graph_dfs.c

* Update graph_bfs.c

* Update graph_dfs.c

* Update graph_bfs.c

* Update output "初始化后,图为:" of graph_dfs.c

* Update graph_dfs.c

* Update graph_bfs.c

* Update graph_dfs.c

* Update name of arrayVertex

* Update name of arrayVertex

* Update note of graph_dfs.c

* Update note of graph_bfs.c

* Update graph_dfs.c

* Update graph_bfs.c

* Update graph_adjacency_matrix.c

* Update graph_adjacency_list_test.c

* Update graph_adjacency_list.c

* Update graph_dfs.c

* Update graph_bfs.c

* Update comment

* Update comment

* Update graph_adjacency_list.c

* Update graph_adjacency_matrix.c

* update comment

* update comment

* update comment for graph operation

* update comment of graph operation

* update comment

* update comment

---------

Co-authored-by: Yudong Jin <krahets@163.com>
Co-authored-by: libr <libr@info2soft.com>
2023-07-20 19:08:23 +08:00
Hongyun Zhang
4e4a13e1bb
feat: Add Go code to binary search recursion under divide and conquer (#630)
* feat: Add Go code to binary search recursion under divide and conquer

* style: Code comment standardization

* style: modify function comment
2023-07-20 18:57:28 +08:00
hpstory
2af77ff565
feat(csharp): add csharp code for array binary tree (#632) 2023-07-20 18:54:40 +08:00
Yudong Jin
2b7d7aa827
Add the chapter of greedy. (#633)
Add the section of fractional knapsack.
2023-07-20 18:26:54 +08:00
krahets
c54536d1a1 Modify the problem of preorder_traversal_iii 2023-07-19 16:37:12 +08:00
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
c68f18e480 Finetune 2023-07-19 01:45:14 +08:00
ZongYangL
03cbf5b972
Anonymous inner classes create generic instances that display the dec… (#627)
* Anonymous inner classes create generic instances that display the declared type

* Update TreeNode.java

* Update binary_tree_bfs.java

* Update graph_bfs.java

---------

Co-authored-by: zongjianwei <zongjianwei@meituan.com>
Co-authored-by: Yudong Jin <krahets@163.com>
2023-07-19 01:37:55 +08:00
hpstory
7a6fd4b3dd
feat(csharp): add csharp code for charper divide and conquer (#628) 2023-07-19 01:19:49 +08:00
sjinzh
8737fc66dd
rust : add codes for chapter_divide_and_conquer (#621) 2023-07-19 00:32:05 +08:00
nuomi1
9ea8a73059
Feature/chapter dynamic programming swift (#608)
* feat: add Swift codes for intro_to_dynamic_programming article

* feat: add Swift codes for dp_problem_features article

* feat: add Swift codes for dp_solution_pipeline article

* feat: add Swift codes for knapsack_problem article

* feat: add Swift codes for unbounded_knapsack_problem article

* feat: add Swift codes for edit_distance_problem article
2023-07-18 12:49:03 +08:00
krahets
1f784dadb0 Add Java and C++ code for the chapter of
divide and conquer.
2023-07-17 04:20:12 +08:00
krahets
fc7bcb615d Add the section of binary_search_recur. 2023-07-17 03:48:33 +08:00
Yudong Jin
909daea105
Add the section of hanota problem. (#614) 2023-07-17 02:20:49 +08:00