mirror of
https://github.com/krahets/hello-algo.git
synced 2025-01-23 06:00:27 +08:00
Rename the common modules in Java, C++ and C.
This commit is contained in:
parent
c6eecfd0dc
commit
145975b335
@ -5,7 +5,6 @@ set(CMAKE_C_STANDARD 11)
|
||||
|
||||
include_directories(./include)
|
||||
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(chapter_computational_complexity)
|
||||
add_subdirectory(chapter_array_and_linkedlist)
|
||||
add_subdirectory(chapter_stack_and_queue)
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: MolDuM (moldum@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 随机返回一个数组元素 */
|
||||
int randomAccess(int *nums, int size) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Zero (glj0@outlook.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 在链表的节点 n0 之后插入节点 P */
|
||||
void insert(ListNode *n0, ListNode *P) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Zero (glj0@outlook.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 列表类简易实现 */
|
||||
struct myList {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Guanngxu (446678850@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 二分查找(双闭区间) */
|
||||
int binarySearch(int *nums, int len, int target) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Created Time: 2023-04-15
|
||||
* Author: Gonglja (glj0@outlook.com)
|
||||
*/
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 函数 */
|
||||
int func() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: sjinzh (sjinzh@gmail.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 常数阶 */
|
||||
int constant(int n) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: sjinzh (sjinzh@gmail.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 生成一个数组,元素为 { 1, 2, ..., n },顺序被打乱 */
|
||||
int *randomNumbers(int n) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Guanngxu (446678850@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 哈希表默认数组大小 */
|
||||
# define HASH_MAP_DEFAULT_SIZE 100
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
#define MAX_SIZE 5000
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Gonglja (glj0@outlook.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 哈希表 */
|
||||
struct hashTable {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 方法一:暴力枚举 */
|
||||
int *twoSumBruteForce(int *nums, int numsSize, int target, int *returnSize) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Guanngxu (446678850@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 线性查找(数组) */
|
||||
int linearSearchArray(int *nums, int len, int target) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Listening (https://github.com/L-Super)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 冒泡排序 */
|
||||
void bubbleSort(int nums[], int size) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com), Guanngxu (446678850@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 计数排序 */
|
||||
// 简单实现,无法用于排序对象
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Listening (https://github.com/L-Super)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 插入排序 */
|
||||
void insertionSort(int nums[], int size) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Guanngxu (446678850@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 合并左子数组和右子数组 */
|
||||
// 左子数组区间 [left, mid]
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 元素交换 */
|
||||
void swap(int nums[], int i, int j) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 获取元素 num 的第 k 位,其中 exp = 10^(k-1) */
|
||||
int digit(int num, int exp) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Gonglja (glj0@outlook.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 基于环形数组实现的双向队列 */
|
||||
struct arrayDeque {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Zero (glj0@outlook.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 基于环形数组实现的队列 */
|
||||
struct arrayQueue {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Zero (glj0@outlook.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
#define MAX_SIZE 5000
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Gonglja (glj0@outlook.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 双向链表节点 */
|
||||
struct doublyListNode {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Gonglja (glj0@outlook.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 基于链表实现的队列 */
|
||||
struct linkedListQueue {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Zero (glj0@outlook.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 基于链表实现的栈 */
|
||||
struct linkedListStack {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* AVL Tree */
|
||||
struct aVLTree {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 二叉搜索树 */
|
||||
struct binarySearchTree {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* Driver Code */
|
||||
int main() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 层序遍历 */
|
||||
int *levelOrder(TreeNode *root, int *size) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.h"
|
||||
#include "../utils/common.h"
|
||||
|
||||
/* 辅助数组,用于存储遍历序列 */
|
||||
int *arr;
|
||||
|
@ -1,5 +0,0 @@
|
||||
add_executable(include
|
||||
include_test.c
|
||||
include.h print_util.h
|
||||
list_node.h tree_node.h
|
||||
uthash.h)
|
5
codes/c/utils/CMakeLists.txt
Normal file
5
codes/c/utils/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_executable(utils
|
||||
common_test.c
|
||||
common.h print_util.h
|
||||
list_node.h tree_node.h
|
||||
uthash.h)
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: include.h
|
||||
* File: common.h
|
||||
* Created Time: 2022-12-20
|
||||
* Author: MolDuM (moldum@163.com)、Reanon (793584285@qq.com)
|
||||
*/
|
@ -4,7 +4,7 @@
|
||||
* Author: Reanon (793584285@qq.com)
|
||||
*/
|
||||
|
||||
#include "include.h"
|
||||
#include "common.h"
|
||||
|
||||
void testListNode() {
|
||||
int nums[] = {2, 3, 5, 6, 7};
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 随机返回一个数组元素 */
|
||||
int randomAccess(int *nums, int size) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 在链表的节点 n0 之后插入节点 P */
|
||||
void insert(ListNode *n0, ListNode *P) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* Driver Code */
|
||||
int main() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 列表类简易实现 */
|
||||
class MyList {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 回溯算法:全排列 I */
|
||||
void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 回溯算法:全排列 II */
|
||||
void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
vector<TreeNode *> res;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
vector<TreeNode *> path;
|
||||
vector<vector<TreeNode *>> res;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
vector<TreeNode *> path;
|
||||
vector<vector<TreeNode *>> res;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 判断当前状态是否为解 */
|
||||
bool isSolution(vector<TreeNode *> &state) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 二分查找(双闭区间) */
|
||||
int binarySearch(vector<int> &nums, int target) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 函数 */
|
||||
int func() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 常数阶 */
|
||||
int constant(int n) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 生成一个数组,元素为 { 1, 2, ..., n },顺序被打乱 */
|
||||
vector<int> randomNumbers(int n) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: what-is-me (whatisme@outlook.jp), Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 基于邻接表实现的无向图类 */
|
||||
class GraphAdjList {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: what-is-me (whatisme@outlook.jp)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 基于邻接矩阵实现的无向图类 */
|
||||
class GraphAdjMat {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
#include "./graph_adjacency_list.cpp"
|
||||
|
||||
/* 广度优先遍历 BFS */
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
#include "./graph_adjacency_list.cpp"
|
||||
|
||||
/* 深度优先遍历 DFS 辅助函数 */
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: msk397 (machangxinq@gmail.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 键值对 int->String */
|
||||
struct Entry {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: msk397 (machangxinq@gmail.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* Driver Code */
|
||||
int main() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: LoneRanger(836253168@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
void testPush(priority_queue<int> &heap, int val) {
|
||||
heap.push(val); // 元素入堆
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: LoneRanger (836253168@qq.com), what-is-me (whatisme@outlook.jp)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 大顶堆 */
|
||||
class MaxHeap {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 哈希查找(数组) */
|
||||
int hashingSearchArray(unordered_map<int, int> map, int target) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 方法一:暴力枚举 */
|
||||
vector<int> twoSumBruteForce(vector<int> &nums, int target) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 线性查找(数组) */
|
||||
int linearSearchArray(vector<int> &nums, int target) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 冒泡排序 */
|
||||
void bubbleSort(vector<int> &nums) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 桶排序 */
|
||||
void bucketSort(vector<float> &nums) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 计数排序 */
|
||||
// 简单实现,无法用于排序对象
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 插入排序 */
|
||||
void insertionSort(vector<int> &nums) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 合并左子数组和右子数组 */
|
||||
// 左子数组区间 [left, mid]
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 快速排序类 */
|
||||
class QuickSort {
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 获取元素 num 的第 k 位,其中 exp = 10^(k-1) */
|
||||
int digit(int num, int exp) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 基于环形数组实现的双向队列 */
|
||||
class ArrayDeque {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 基于环形数组实现的队列 */
|
||||
class ArrayQueue {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: qualifier1024 (2539244001@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 基于数组实现的栈 */
|
||||
class ArrayStack {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* Driver Code */
|
||||
int main() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 双向链表节点 */
|
||||
struct DoublyListNode {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 基于链表实现的队列 */
|
||||
class LinkedListQueue {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: qualifier1024 (2539244001@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 基于链表实现的栈 */
|
||||
class LinkedListStack {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: qualifier1024 (2539244001@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* Driver Code */
|
||||
int main() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: qualifier1024 (2539244001@qq.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* Driver Code */
|
||||
int main() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: what-is-me (whatisme@outlook.jp)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* AVL 树 */
|
||||
class AVLTree {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 二叉搜索树 */
|
||||
class BinarySearchTree {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* Driver Code */
|
||||
int main() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
/* 层序遍历 */
|
||||
vector<int> levelOrder(TreeNode *root) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#include "../include/include.hpp"
|
||||
#include "../utils/common.hpp"
|
||||
|
||||
// 初始化列表,用于存储遍历序列
|
||||
vector<int> vec;
|
||||
|
@ -1,4 +0,0 @@
|
||||
add_executable(include
|
||||
include.hpp PrintUtil.hpp
|
||||
ListNode.hpp TreeNode.hpp
|
||||
Vertex.hpp)
|
4
codes/cpp/utils/CMakeLists.txt
Normal file
4
codes/cpp/utils/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_executable(utils
|
||||
common.hpp print_utils.hpp
|
||||
list_node.hpp tree_node.hpp
|
||||
vertex.hpp)
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: PrintUtil.hpp
|
||||
* File: common.hpp
|
||||
* Created Time: 2021-12-19
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
@ -20,9 +20,9 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "ListNode.hpp"
|
||||
#include "PrintUtil.hpp"
|
||||
#include "TreeNode.hpp"
|
||||
#include "Vertex.hpp"
|
||||
#include "list_node.hpp"
|
||||
#include "print_utils.hpp"
|
||||
#include "tree_node.hpp"
|
||||
#include "vertex.hpp"
|
||||
|
||||
using namespace std;
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: PrintUtil.hpp
|
||||
* File: list_node.hpp
|
||||
* Created Time: 2021-12-19
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* File: PrintUtil.hpp
|
||||
* File: print_utils.hpp
|
||||
* Created Time: 2021-12-19
|
||||
* Author: Krahets (krahets@163.com), msk397 (machangxinq@gmail.com), LoneRanger(836253168@qq.com)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ListNode.hpp"
|
||||
#include "TreeNode.hpp"
|
||||
#include "list_node.hpp"
|
||||
#include "tree_node.hpp"
|
||||
#include <climits>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: PrintUtil.hpp
|
||||
* File: tree_node.hpp
|
||||
* Created Time: 2021-12-19
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: PrintUtil.hpp
|
||||
* File: vertex.hpp
|
||||
* Created Time: 2023-03-02
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: graph_adjacency_list.cs
|
||||
* File: Vertex.cs
|
||||
* Created Time: 2023-02-06
|
||||
* Author: zjkung1123 (zjkung1123@gmail.com), krahets (krahets@163.com)
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: ListNode
|
||||
* File: list_node.dart
|
||||
* Created Time: 2023-01-23
|
||||
* Author: Jefferson (JeffersonHuang77@gmail.com)
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: PrintUtil
|
||||
* File: print_util.dart
|
||||
* Created Time: 2023-01-23
|
||||
* Author: Jefferson (JeffersonHuang77@gmail.com)
|
||||
*/
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
package chapter_array_and_linkedlist;
|
||||
|
||||
import include.*;
|
||||
import utils.*;
|
||||
|
||||
public class linked_list {
|
||||
/* 在链表的节点 n0 之后插入节点 P */
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
package chapter_backtracking;
|
||||
|
||||
import include.*;
|
||||
import utils.*;
|
||||
import java.util.*;
|
||||
|
||||
public class preorder_traversal_i_compact {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
package chapter_backtracking;
|
||||
|
||||
import include.*;
|
||||
import utils.*;
|
||||
import java.util.*;
|
||||
|
||||
public class preorder_traversal_ii_compact {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
package chapter_backtracking;
|
||||
|
||||
import include.*;
|
||||
import utils.*;
|
||||
import java.util.*;
|
||||
|
||||
public class preorder_traversal_iii_compact {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
package chapter_backtracking;
|
||||
|
||||
import include.*;
|
||||
import utils.*;
|
||||
import java.util.*;
|
||||
|
||||
public class preorder_traversal_iii_template {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
package chapter_computational_complexity;
|
||||
|
||||
import include.*;
|
||||
import utils.*;
|
||||
import java.util.*;
|
||||
|
||||
public class space_complexity {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user