Commit graph

1684 commits

Author SHA1 Message Date
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
f1ef7e9d10 Move documents to a sub-directory
to support multi-language selector.
2023-10-06 00:57:28 +08:00
krahets
04e2a46bcd fine tune 2023-10-05 14:34:42 +08:00
Nepenthe
bcb5bf641a
Update hash_algorithm.md (#836)
* Update hash_algorithm.md

- Add the hiding property required for the hash algorithm in security domain.

* Update hash_algorithm.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-03 13:32:49 -05:00
krahets
4355f8d49f Several bug fixes. 2023-10-04 02:30:31 +08:00
lucas
0e3d2ce4bb
feat: Add rust code in binary_tree.md (#759)
* feat: Add binary_tree.md

* Update binary_tree.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-02 11:43:24 -05:00
Nepenthe
d86cb0ee5d
Update array.md & hash_map.md (#827)
* Update array.md

- Update array.md
- Add comments to maintain consistency with implementations in other languages.

* Update hash_map.md

- Update hash_map.md
- Update the filename to correspond with the filenames in the "codes/go" directory.
2023-10-02 11:13:44 -05:00
Nepenthe
dbf6c1c68d
fix: typo (#826) 2023-10-02 11:10:41 -05:00
krahets
98538b924f Several bugs fixes and improvments; 2023-10-01 19:33:53 +08:00
Wang Jianing
ddb2f9e024
Update suggestions (#812)
* Update suggestions

Here I think using "code warehouse" instead of "code warehouse" can eliminate unnecessary ambiguity.

* Update suggestions.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-10-01 06:30:32 -05:00
易春风
cbe76b58a2
feat: add rust docs (#815)
* feat: add rust docs

* Import std types for built_in_hash doc
2023-10-01 06:25:03 -05: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
Phoenix0415
79ee529b47
Update deque.md (#808)
* Update deque.md

添加了信息:
其名字"deque"是"double-ended queue"的缩写,反映了这种数据结构的主要特点。"

帮助读者更好记住deque的英文名,也能更好联系到其特性

* Update deque.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-28 01:53:16 -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
Turing-1024-Lee
ea7eb514fc
Update graph_traversal.md (#801)
笔误文字重复
2023-09-25 22:05:13 -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
krahets
cbea6c584d fix Dockerfile 2023-09-24 22:57:45 +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
kilikilikid
0f0892b8f5
Update dp_problem_features.md (#772)
* Update dp_problem_features.md

这样的中文描述和转移方程更加一致

* Update dp_problem_features.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-09-24 03:42:17 -05: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
krahets
af65ab08ef Update .gitignore
Remove prev and next button in footer.html
2023-09-21 20:48:54 +08:00
malone6
16574186ee
feat: add previous and next button in content.html (#763)
* 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

* feat: Move the pagination nav above the comments

* feat: Move the pagination nav above the comments

* Delete docs/overrides/partials/footer.html

* Update content.html

---------

Co-authored-by: Yudong Jin <krahets@163.com>
Co-authored-by: long.ma <long.ma@sumscope.com>
2023-09-21 05:39:29 -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
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