Rename the common modules in Java, C++ and C.

This commit is contained in:
krahets 2023-04-24 04:11:18 +08:00
parent c6eecfd0dc
commit 145975b335
120 changed files with 122 additions and 380 deletions

View File

@ -5,7 +5,6 @@ set(CMAKE_C_STANDARD 11)
include_directories(./include) include_directories(./include)
add_subdirectory(include)
add_subdirectory(chapter_computational_complexity) add_subdirectory(chapter_computational_complexity)
add_subdirectory(chapter_array_and_linkedlist) add_subdirectory(chapter_array_and_linkedlist)
add_subdirectory(chapter_stack_and_queue) add_subdirectory(chapter_stack_and_queue)

View File

@ -4,7 +4,7 @@
* Author: MolDuM (moldum@163.com) * Author: MolDuM (moldum@163.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 随机返回一个数组元素 */ /* 随机返回一个数组元素 */
int randomAccess(int *nums, int size) { int randomAccess(int *nums, int size) {

View File

@ -4,7 +4,7 @@
* Author: Zero (glj0@outlook.com) * Author: Zero (glj0@outlook.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 在链表的节点 n0 之后插入节点 P */ /* 在链表的节点 n0 之后插入节点 P */
void insert(ListNode *n0, ListNode *P) { void insert(ListNode *n0, ListNode *P) {

View File

@ -4,7 +4,7 @@
* Author: Zero (glj0@outlook.com) * Author: Zero (glj0@outlook.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 列表类简易实现 */ /* 列表类简易实现 */
struct myList { struct myList {

View File

@ -4,7 +4,7 @@
* Author: Guanngxu (446678850@qq.com) * Author: Guanngxu (446678850@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 二分查找(双闭区间) */ /* 二分查找(双闭区间) */
int binarySearch(int *nums, int len, int target) { int binarySearch(int *nums, int len, int target) {

View File

@ -3,7 +3,7 @@
* Created Time: 2023-04-15 * Created Time: 2023-04-15
* Author: Gonglja (glj0@outlook.com) * Author: Gonglja (glj0@outlook.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 函数 */ /* 函数 */
int func() { int func() {

View File

@ -4,7 +4,7 @@
* Author: sjinzh (sjinzh@gmail.com) * Author: sjinzh (sjinzh@gmail.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 常数阶 */ /* 常数阶 */
int constant(int n) { int constant(int n) {

View File

@ -4,7 +4,7 @@
* Author: sjinzh (sjinzh@gmail.com) * Author: sjinzh (sjinzh@gmail.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 生成一个数组,元素为 { 1, 2, ..., n },顺序被打乱 */ /* 生成一个数组,元素为 { 1, 2, ..., n },顺序被打乱 */
int *randomNumbers(int n) { int *randomNumbers(int n) {

View File

@ -4,7 +4,7 @@
* Author: Guanngxu (446678850@qq.com) * Author: Guanngxu (446678850@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 哈希表默认数组大小 */ /* 哈希表默认数组大小 */
# define HASH_MAP_DEFAULT_SIZE 100 # define HASH_MAP_DEFAULT_SIZE 100

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com) * Author: Reanon (793584285@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
#define MAX_SIZE 5000 #define MAX_SIZE 5000

View File

@ -4,7 +4,7 @@
* Author: Gonglja (glj0@outlook.com) * Author: Gonglja (glj0@outlook.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 哈希表 */ /* 哈希表 */
struct hashTable { struct hashTable {

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com) * Author: Reanon (793584285@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 方法一:暴力枚举 */ /* 方法一:暴力枚举 */
int *twoSumBruteForce(int *nums, int numsSize, int target, int *returnSize) { int *twoSumBruteForce(int *nums, int numsSize, int target, int *returnSize) {

View File

@ -4,7 +4,7 @@
* Author: Guanngxu (446678850@qq.com) * Author: Guanngxu (446678850@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 线性查找(数组) */ /* 线性查找(数组) */
int linearSearchArray(int *nums, int len, int target) { int linearSearchArray(int *nums, int len, int target) {

View File

@ -4,7 +4,7 @@
* Author: Listening (https://github.com/L-Super) * Author: Listening (https://github.com/L-Super)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 冒泡排序 */ /* 冒泡排序 */
void bubbleSort(int nums[], int size) { void bubbleSort(int nums[], int size) {

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com), Guanngxu (446678850@qq.com) * Author: Reanon (793584285@qq.com), Guanngxu (446678850@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 计数排序 */ /* 计数排序 */
// 简单实现,无法用于排序对象 // 简单实现,无法用于排序对象

View File

@ -4,7 +4,7 @@
* Author: Listening (https://github.com/L-Super) * Author: Listening (https://github.com/L-Super)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 插入排序 */ /* 插入排序 */
void insertionSort(int nums[], int size) { void insertionSort(int nums[], int size) {

View File

@ -4,7 +4,7 @@
* Author: Guanngxu (446678850@qq.com) * Author: Guanngxu (446678850@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 合并左子数组和右子数组 */ /* 合并左子数组和右子数组 */
// 左子数组区间 [left, mid] // 左子数组区间 [left, mid]

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com) * Author: Reanon (793584285@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 元素交换 */ /* 元素交换 */
void swap(int nums[], int i, int j) { void swap(int nums[], int i, int j) {

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com) * Author: Reanon (793584285@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 获取元素 num 的第 k 位,其中 exp = 10^(k-1) */ /* 获取元素 num 的第 k 位,其中 exp = 10^(k-1) */
int digit(int num, int exp) { int digit(int num, int exp) {

View File

@ -4,7 +4,7 @@
* Author: Gonglja (glj0@outlook.com) * Author: Gonglja (glj0@outlook.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 基于环形数组实现的双向队列 */ /* 基于环形数组实现的双向队列 */
struct arrayDeque { struct arrayDeque {

View File

@ -4,7 +4,7 @@
* Author: Zero (glj0@outlook.com) * Author: Zero (glj0@outlook.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 基于环形数组实现的队列 */ /* 基于环形数组实现的队列 */
struct arrayQueue { struct arrayQueue {

View File

@ -4,7 +4,7 @@
* Author: Zero (glj0@outlook.com) * Author: Zero (glj0@outlook.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
#define MAX_SIZE 5000 #define MAX_SIZE 5000

View File

@ -4,7 +4,7 @@
* Author: Gonglja (glj0@outlook.com) * Author: Gonglja (glj0@outlook.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 双向链表节点 */ /* 双向链表节点 */
struct doublyListNode { struct doublyListNode {

View File

@ -4,7 +4,7 @@
* Author: Gonglja (glj0@outlook.com) * Author: Gonglja (glj0@outlook.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 基于链表实现的队列 */ /* 基于链表实现的队列 */
struct linkedListQueue { struct linkedListQueue {

View File

@ -4,7 +4,7 @@
* Author: Zero (glj0@outlook.com) * Author: Zero (glj0@outlook.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 基于链表实现的栈 */ /* 基于链表实现的栈 */
struct linkedListStack { struct linkedListStack {

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com) * Author: Reanon (793584285@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* AVL Tree */ /* AVL Tree */
struct aVLTree { struct aVLTree {

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com) * Author: Reanon (793584285@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 二叉搜索树 */ /* 二叉搜索树 */
struct binarySearchTree { struct binarySearchTree {

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com) * Author: Reanon (793584285@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* Driver Code */ /* Driver Code */
int main() { int main() {

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com) * Author: Reanon (793584285@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 层序遍历 */ /* 层序遍历 */
int *levelOrder(TreeNode *root, int *size) { int *levelOrder(TreeNode *root, int *size) {

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com) * Author: Reanon (793584285@qq.com)
*/ */
#include "../include/include.h" #include "../utils/common.h"
/* 辅助数组,用于存储遍历序列 */ /* 辅助数组,用于存储遍历序列 */
int *arr; int *arr;

View File

@ -1,5 +0,0 @@
add_executable(include
include_test.c
include.h print_util.h
list_node.h tree_node.h
uthash.h)

View File

@ -0,0 +1,5 @@
add_executable(utils
common_test.c
common.h print_util.h
list_node.h tree_node.h
uthash.h)

View File

@ -1,5 +1,5 @@
/** /**
* File: include.h * File: common.h
* Created Time: 2022-12-20 * Created Time: 2022-12-20
* Author: MolDuM (moldum@163.com)Reanon (793584285@qq.com) * Author: MolDuM (moldum@163.com)Reanon (793584285@qq.com)
*/ */

View File

@ -4,7 +4,7 @@
* Author: Reanon (793584285@qq.com) * Author: Reanon (793584285@qq.com)
*/ */
#include "include.h" #include "common.h"
void testListNode() { void testListNode() {
int nums[] = {2, 3, 5, 6, 7}; int nums[] = {2, 3, 5, 6, 7};

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 随机返回一个数组元素 */ /* 随机返回一个数组元素 */
int randomAccess(int *nums, int size) { int randomAccess(int *nums, int size) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 在链表的节点 n0 之后插入节点 P */ /* 在链表的节点 n0 之后插入节点 P */
void insert(ListNode *n0, ListNode *P) { void insert(ListNode *n0, ListNode *P) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* Driver Code */ /* Driver Code */
int main() { int main() {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 列表类简易实现 */ /* 列表类简易实现 */
class MyList { class MyList {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 回溯算法:全排列 I */ /* 回溯算法:全排列 I */
void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) { void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 回溯算法:全排列 II */ /* 回溯算法:全排列 II */
void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) { void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
vector<TreeNode *> res; vector<TreeNode *> res;

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
vector<TreeNode *> path; vector<TreeNode *> path;
vector<vector<TreeNode *>> res; vector<vector<TreeNode *>> res;

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
vector<TreeNode *> path; vector<TreeNode *> path;
vector<vector<TreeNode *>> res; vector<vector<TreeNode *>> res;

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 判断当前状态是否为解 */ /* 判断当前状态是否为解 */
bool isSolution(vector<TreeNode *> &state) { bool isSolution(vector<TreeNode *> &state) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 二分查找(双闭区间) */ /* 二分查找(双闭区间) */
int binarySearch(vector<int> &nums, int target) { int binarySearch(vector<int> &nums, int target) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 函数 */ /* 函数 */
int func() { int func() {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 常数阶 */ /* 常数阶 */
int constant(int n) { int constant(int n) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 生成一个数组,元素为 { 1, 2, ..., n },顺序被打乱 */ /* 生成一个数组,元素为 { 1, 2, ..., n },顺序被打乱 */
vector<int> randomNumbers(int n) { vector<int> randomNumbers(int n) {

View File

@ -4,7 +4,7 @@
* Author: what-is-me (whatisme@outlook.jp), Krahets (krahets@163.com) * Author: what-is-me (whatisme@outlook.jp), Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 基于邻接表实现的无向图类 */ /* 基于邻接表实现的无向图类 */
class GraphAdjList { class GraphAdjList {

View File

@ -4,7 +4,7 @@
* Author: what-is-me (whatisme@outlook.jp) * Author: what-is-me (whatisme@outlook.jp)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 基于邻接矩阵实现的无向图类 */ /* 基于邻接矩阵实现的无向图类 */
class GraphAdjMat { class GraphAdjMat {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
#include "./graph_adjacency_list.cpp" #include "./graph_adjacency_list.cpp"
/* 广度优先遍历 BFS */ /* 广度优先遍历 BFS */

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
#include "./graph_adjacency_list.cpp" #include "./graph_adjacency_list.cpp"
/* 深度优先遍历 DFS 辅助函数 */ /* 深度优先遍历 DFS 辅助函数 */

View File

@ -4,7 +4,7 @@
* Author: msk397 (machangxinq@gmail.com) * Author: msk397 (machangxinq@gmail.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 键值对 int->String */ /* 键值对 int->String */
struct Entry { struct Entry {

View File

@ -4,7 +4,7 @@
* Author: msk397 (machangxinq@gmail.com) * Author: msk397 (machangxinq@gmail.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* Driver Code */ /* Driver Code */
int main() { int main() {

View File

@ -4,7 +4,7 @@
* Author: LoneRanger(836253168@qq.com) * Author: LoneRanger(836253168@qq.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
void testPush(priority_queue<int> &heap, int val) { void testPush(priority_queue<int> &heap, int val) {
heap.push(val); // 元素入堆 heap.push(val); // 元素入堆

View File

@ -4,7 +4,7 @@
* Author: LoneRanger (836253168@qq.com), what-is-me (whatisme@outlook.jp) * Author: LoneRanger (836253168@qq.com), what-is-me (whatisme@outlook.jp)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 大顶堆 */ /* 大顶堆 */
class MaxHeap { class MaxHeap {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 哈希查找(数组) */ /* 哈希查找(数组) */
int hashingSearchArray(unordered_map<int, int> map, int target) { int hashingSearchArray(unordered_map<int, int> map, int target) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 方法一:暴力枚举 */ /* 方法一:暴力枚举 */
vector<int> twoSumBruteForce(vector<int> &nums, int target) { vector<int> twoSumBruteForce(vector<int> &nums, int target) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 线性查找(数组) */ /* 线性查找(数组) */
int linearSearchArray(vector<int> &nums, int target) { int linearSearchArray(vector<int> &nums, int target) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 冒泡排序 */ /* 冒泡排序 */
void bubbleSort(vector<int> &nums) { void bubbleSort(vector<int> &nums) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 桶排序 */ /* 桶排序 */
void bucketSort(vector<float> &nums) { void bucketSort(vector<float> &nums) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 计数排序 */ /* 计数排序 */
// 简单实现,无法用于排序对象 // 简单实现,无法用于排序对象

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 插入排序 */ /* 插入排序 */
void insertionSort(vector<int> &nums) { void insertionSort(vector<int> &nums) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 合并左子数组和右子数组 */ /* 合并左子数组和右子数组 */
// 左子数组区间 [left, mid] // 左子数组区间 [left, mid]

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 快速排序类 */ /* 快速排序类 */
class QuickSort { class QuickSort {

View File

@ -5,7 +5,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 获取元素 num 的第 k 位,其中 exp = 10^(k-1) */ /* 获取元素 num 的第 k 位,其中 exp = 10^(k-1) */
int digit(int num, int exp) { int digit(int num, int exp) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 基于环形数组实现的双向队列 */ /* 基于环形数组实现的双向队列 */
class ArrayDeque { class ArrayDeque {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 基于环形数组实现的队列 */ /* 基于环形数组实现的队列 */
class ArrayQueue { class ArrayQueue {

View File

@ -4,7 +4,7 @@
* Author: qualifier1024 (2539244001@qq.com) * Author: qualifier1024 (2539244001@qq.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 基于数组实现的栈 */ /* 基于数组实现的栈 */
class ArrayStack { class ArrayStack {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* Driver Code */ /* Driver Code */
int main() { int main() {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 双向链表节点 */ /* 双向链表节点 */
struct DoublyListNode { struct DoublyListNode {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 基于链表实现的队列 */ /* 基于链表实现的队列 */
class LinkedListQueue { class LinkedListQueue {

View File

@ -4,7 +4,7 @@
* Author: qualifier1024 (2539244001@qq.com) * Author: qualifier1024 (2539244001@qq.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 基于链表实现的栈 */ /* 基于链表实现的栈 */
class LinkedListStack { class LinkedListStack {

View File

@ -4,7 +4,7 @@
* Author: qualifier1024 (2539244001@qq.com) * Author: qualifier1024 (2539244001@qq.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* Driver Code */ /* Driver Code */
int main() { int main() {

View File

@ -4,7 +4,7 @@
* Author: qualifier1024 (2539244001@qq.com) * Author: qualifier1024 (2539244001@qq.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* Driver Code */ /* Driver Code */
int main() { int main() {

View File

@ -4,7 +4,7 @@
* Author: what-is-me (whatisme@outlook.jp) * Author: what-is-me (whatisme@outlook.jp)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* AVL 树 */ /* AVL 树 */
class AVLTree { class AVLTree {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 二叉搜索树 */ /* 二叉搜索树 */
class BinarySearchTree { class BinarySearchTree {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* Driver Code */ /* Driver Code */
int main() { int main() {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
/* 层序遍历 */ /* 层序遍历 */
vector<int> levelOrder(TreeNode *root) { vector<int> levelOrder(TreeNode *root) {

View File

@ -4,7 +4,7 @@
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
#include "../include/include.hpp" #include "../utils/common.hpp"
// 初始化列表,用于存储遍历序列 // 初始化列表,用于存储遍历序列
vector<int> vec; vector<int> vec;

View File

@ -1,4 +0,0 @@
add_executable(include
include.hpp PrintUtil.hpp
ListNode.hpp TreeNode.hpp
Vertex.hpp)

View File

@ -0,0 +1,4 @@
add_executable(utils
common.hpp print_utils.hpp
list_node.hpp tree_node.hpp
vertex.hpp)

View File

@ -1,5 +1,5 @@
/** /**
* File: PrintUtil.hpp * File: common.hpp
* Created Time: 2021-12-19 * Created Time: 2021-12-19
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */
@ -20,9 +20,9 @@
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
#include "ListNode.hpp" #include "list_node.hpp"
#include "PrintUtil.hpp" #include "print_utils.hpp"
#include "TreeNode.hpp" #include "tree_node.hpp"
#include "Vertex.hpp" #include "vertex.hpp"
using namespace std; using namespace std;

View File

@ -1,5 +1,5 @@
/** /**
* File: PrintUtil.hpp * File: list_node.hpp
* Created Time: 2021-12-19 * Created Time: 2021-12-19
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */

View File

@ -1,13 +1,13 @@
/** /**
* File: PrintUtil.hpp * File: print_utils.hpp
* Created Time: 2021-12-19 * Created Time: 2021-12-19
* Author: Krahets (krahets@163.com), msk397 (machangxinq@gmail.com), LoneRanger(836253168@qq.com) * Author: Krahets (krahets@163.com), msk397 (machangxinq@gmail.com), LoneRanger(836253168@qq.com)
*/ */
#pragma once #pragma once
#include "ListNode.hpp" #include "list_node.hpp"
#include "TreeNode.hpp" #include "tree_node.hpp"
#include <climits> #include <climits>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>

View File

@ -1,5 +1,5 @@
/** /**
* File: PrintUtil.hpp * File: tree_node.hpp
* Created Time: 2021-12-19 * Created Time: 2021-12-19
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* File: PrintUtil.hpp * File: vertex.hpp
* Created Time: 2023-03-02 * Created Time: 2023-03-02
* Author: Krahets (krahets@163.com) * Author: Krahets (krahets@163.com)
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* File: graph_adjacency_list.cs * File: Vertex.cs
* Created Time: 2023-02-06 * Created Time: 2023-02-06
* Author: zjkung1123 (zjkung1123@gmail.com), krahets (krahets@163.com) * Author: zjkung1123 (zjkung1123@gmail.com), krahets (krahets@163.com)
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* File: ListNode * File: list_node.dart
* Created Time: 2023-01-23 * Created Time: 2023-01-23
* Author: Jefferson (JeffersonHuang77@gmail.com) * Author: Jefferson (JeffersonHuang77@gmail.com)
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* File: PrintUtil * File: print_util.dart
* Created Time: 2023-01-23 * Created Time: 2023-01-23
* Author: Jefferson (JeffersonHuang77@gmail.com) * Author: Jefferson (JeffersonHuang77@gmail.com)
*/ */

View File

@ -6,7 +6,7 @@
package chapter_array_and_linkedlist; package chapter_array_and_linkedlist;
import include.*; import utils.*;
public class linked_list { public class linked_list {
/* 在链表的节点 n0 之后插入节点 P */ /* 在链表的节点 n0 之后插入节点 P */

View File

@ -6,7 +6,7 @@
package chapter_backtracking; package chapter_backtracking;
import include.*; import utils.*;
import java.util.*; import java.util.*;
public class preorder_traversal_i_compact { public class preorder_traversal_i_compact {

View File

@ -6,7 +6,7 @@
package chapter_backtracking; package chapter_backtracking;
import include.*; import utils.*;
import java.util.*; import java.util.*;
public class preorder_traversal_ii_compact { public class preorder_traversal_ii_compact {

View File

@ -6,7 +6,7 @@
package chapter_backtracking; package chapter_backtracking;
import include.*; import utils.*;
import java.util.*; import java.util.*;
public class preorder_traversal_iii_compact { public class preorder_traversal_iii_compact {

View File

@ -6,7 +6,7 @@
package chapter_backtracking; package chapter_backtracking;
import include.*; import utils.*;
import java.util.*; import java.util.*;
public class preorder_traversal_iii_template { public class preorder_traversal_iii_template {

View File

@ -6,7 +6,7 @@
package chapter_computational_complexity; package chapter_computational_complexity;
import include.*; import utils.*;
import java.util.*; import java.util.*;
public class space_complexity { public class space_complexity {

Some files were not shown because too many files have changed in this diff Show More