Commit graph

2041 commits

Author SHA1 Message Date
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
Qingpeng Li
7cbe284fcf
follow PEP585 typing (#767)
Signed-off-by: Qingpeng Li <qingpeng9802@gmail.com>
2023-09-19 14:41:02 +08:00
krahets
9f59c572b5 fine tune 2023-09-17 01:13:15 +08:00
hts0000
b2246e11a7
feat: add Rust code in queue.md and deque.md (#757)
* feat: add Rust code in queue.md

* feat: add Rust code in deque.md

* style: fix comment style
2023-09-17 00:39:57 +08:00
lucas
0a2ad4489a
feat: add Rust code in stack.md (#748)
* Update stack.md

Add rust sample code

* Update stack.md

* Update stack.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-15 02:11:46 +08:00
Kato0130
eba015c0bb
add Rust codes for hash_map (#751) 2023-09-15 02:09:16 +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
Horbin
e8554975f4
Update what_is_dsa.md (#745)
* Update what_is_dsa.md

优化了语句表达

* Update what_is_dsa.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-13 03:25:20 +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
Horbin
3e41e2f475
Update suggestions.md (#744)
给Rust添加注释说明
2023-09-13 02:51:23 +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
zhouLion
76e953a74c
style: Make the picture not glare in dark theme (#741)
* style: Make the picture not glare in dark theme

* Update extra.css

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-12 03:13:17 +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
krahets
3530f8c5ce prepare 1.0.0b5 release 2023-09-10 22:43:59 +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
Night Cruising
9339dbf9b3
feat: add rust docs for chapter computational complexity (#723) 2023-09-06 16:58:20 +08:00
krahets
7583d0acf8 Update .gitattributes 2023-09-04 03:29:52 +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
e052cb1d3b finetune 2023-08-31 02:32:20 +08:00
krahets
a47a974a6a fix climbing_stairs_constraint_dp code 2023-08-31 02:31:58 +08:00