Skip to content

Commit

Permalink
Merge branch 'krahets:master' into docs/support-golang-chapter1
Browse files Browse the repository at this point in the history
  • Loading branch information
Reanon committed Nov 25, 2022
2 parents 9398e4d + 11fb3f5 commit 6e01c23
Show file tree
Hide file tree
Showing 128 changed files with 1,834 additions and 217 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
</a>
</p>

<h2 align="center">
<h3 align="center">
《 Hello,算法 》
</h2>
</h3>

<p align="center">
动画图解、能运行、可讨论的</br>数据结构与算法快速入门教程
</p>

</br>

<p align="center">
<img src="docs/index.assets/animation.gif" width="700">
</p>

<p align="center">
<em>
前往阅读 >
Expand All @@ -21,21 +27,21 @@
</em>
</p>

---

## 关于本书
### 关于本书

本书是我利用业余时间创作,完全开源免费,不会收取任何费用。

本书定期更新中,希望您可以一同参与到本书的创作中来,详情见 [一起参与创作](https://www.hello-algo.com/chapter_introduction/contribution/)
本书定期更新中,希望您可以一同参与到本书的创作中来,详情见 [一起参与创作](https://www.hello-algo.com/chapter_preface/contribution/)

- 如果发现笔误、无效链接、内容缺失、文字歧义、解释不清晰、行文结构不合理等问题,烦请您帮忙修正内容,以帮助其他读者获取更优质的学习内容。
- 非常欢迎您和我一同来创作本书,包括重写某章节、新增章节、翻译代码至其他编程语言等,如果有意请与我联系 WeChat: krahets-jyd , Email: krahets@163.com
- 非常欢迎您和我一同来创作本书,包括重写某章节、新增章节等,如果有意请与我联系 WeChat: krahets-jyd , Email: krahets@163.com

如果感觉本书对你有所帮助,请点个 Star 支持一下,谢谢!

## License
### 致谢

![cc_by-nc-sa](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)
感谢本开源书的每一位撰稿人,是他们的无私奉献让这本书变得更好,他们的 GitHub ID(按首次提交时间排序)为:krahets, *(等待下一位创作者)*

## License

The **texts, codes, images, photos, and videos** present on this work is licensed under [CC BY-NC-SA-4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
6 changes: 6 additions & 0 deletions codes/cpp/chapter_array_and_linkedlist/array.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: array.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_array_and_linkedlist/linked_list.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: linked_list.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_array_and_linkedlist/list.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: list.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_array_and_linkedlist/my_list.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: my_list.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: leetcode_two_sum.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: space_complexity_types.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: time_complexity_types.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: worst_best_time_complexity.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_searching/binary_search.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: binary_search.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_searching/hashing_search.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: hashing_search.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_searching/linear_search.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: linear_search.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_sorting/bubble_sort.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: bubble_sort.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_sorting/insertion_sort.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: insertion_sort.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_sorting/merge_sort.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: merge_sort.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_sorting/quick_sort.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: quick_sort.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_stack_and_queue/array_queue.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: array_queue.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_stack_and_queue/array_stack.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: array_stack.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_stack_and_queue/deque.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: deque.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_stack_and_queue/linkedlist_queue.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: linkedlist_queue.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_stack_and_queue/linkedlist_stack.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: linkedlist_stack.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_stack_and_queue/queue.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: queue.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_stack_and_queue/stack.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: stack.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_tree/binary_search_tree.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: binary_search_tree.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_tree/binary_tree.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: binary_tree.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_tree/binary_tree_bfs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: binary_tree_bfs.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

6 changes: 6 additions & 0 deletions codes/cpp/chapter_tree/binary_tree_dfs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* File: binary_tree_dfs.cpp
* Created Time: 2022-11-25
* Author: Krahets (krahets@163.com)
*/

50 changes: 50 additions & 0 deletions codes/cpp/include/ListNode.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* File: PrintUtil.hpp
* Created Time: 2021-12-19
* Author: Krahets (krahets@163.com)
*/

#pragma once

#include <iostream>
using namespace std;

/**
* @brief Definition for a singly-linked list node
*
*/
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};

/**
* @brief Generate a linked list with a vector
*
* @param list
* @return ListNode*
*/
ListNode* vectorToLinkedList(vector<int> list) {
ListNode *dum = new ListNode(0);
ListNode *head = dum;
for (int val : list) {
head->next = new ListNode(val);
head = head->next;
}
return dum->next;
}

/**
* @brief Get a list node with specific value from a linked list
*
* @param head
* @param val
* @return ListNode*
*/
ListNode* getListNode(ListNode *head, int val) {
while (head != nullptr && head->val != val) {
head = head->next;
}
return head;
}
Loading

0 comments on commit 6e01c23

Please sign in to comment.