Commit graph

1059 commits

Author SHA1 Message Date
王作勋
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