refactor: use global using to reduce usings in each file (#486)
This commit is contained in:
parent
db6caf0d43
commit
40319e7f30
2
codes/csharp/GlobalUsing.cs
Normal file
2
codes/csharp/GlobalUsing.cs
Normal file
@ -0,0 +1,2 @@
|
||||
global using NUnit.Framework;
|
||||
global using hello_algo.utils;
|
@ -2,8 +2,6 @@
|
||||
// Created Time: 2022-12-14
|
||||
// Author: mingXta (1195669834@qq.com)
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_array_and_linkedlist;
|
||||
|
||||
public class array {
|
||||
|
@ -2,9 +2,6 @@
|
||||
// Created Time: 2022-12-16
|
||||
// Author: mingXta (1195669834@qq.com)
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_array_and_linkedlist;
|
||||
|
||||
public class linked_list {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_array_and_linkedlist;
|
||||
|
||||
public class list {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_array_and_linkedlist;
|
||||
|
||||
/* 列表类简易实现 */
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class n_queens {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class permutations_i {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class permutations_ii {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class preorder_traversal_i_compact {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class preorder_traversal_ii_compact {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class preorder_traversal_iii_compact {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class preorder_traversal_iii_template {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_binary_search;
|
||||
|
||||
public class binary_search {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_computational_complexity;
|
||||
|
||||
public class space_complexity {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_computational_complexity;
|
||||
|
||||
public class time_complexity {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_computational_complexity;
|
||||
|
||||
public class worst_best_time_complexity {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: zjkung1123 (zjkung1123@gmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_graph;
|
||||
|
||||
/* 基于邻接表实现的无向图类 */
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: zjkung1123 (zjkung1123@gmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_graph;
|
||||
|
||||
/* 基于邻接矩阵实现的无向图类 */
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_graph;
|
||||
|
||||
public class graph_bfs {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_graph;
|
||||
|
||||
public class graph_dfs {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_hashing;
|
||||
|
||||
/* 键值对 int->string */
|
||||
|
@ -5,9 +5,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_hashing;
|
||||
|
||||
public class hash_map {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: zjkung1123 (zjkung1123@gmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_heap;
|
||||
|
||||
public class heap {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: zjkung1123 (zjkung1123@gmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_heap;
|
||||
|
||||
/* 大顶堆 */
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_searching;
|
||||
|
||||
public class hashing_search {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_searching;
|
||||
|
||||
public class leetcode_two_sum {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_searching;
|
||||
|
||||
public class linear_search {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_sorting;
|
||||
|
||||
public class bubble_sort {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_sorting;
|
||||
|
||||
public class bucket_sort {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_sorting;
|
||||
|
||||
public class counting_sort {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_sorting;
|
||||
|
||||
public class insertion_sort {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_sorting;
|
||||
|
||||
public class merge_sort {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_sorting;
|
||||
|
||||
class QuickSort {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_sorting;
|
||||
|
||||
public class radix_sort {
|
||||
|
@ -4,11 +4,10 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
namespace hello_algo.chapter_stack_and_queue;
|
||||
|
||||
namespace hello_algo.chapter_stack_and_queue {
|
||||
/* 基于环形数组实现的双向队列 */
|
||||
public class ArrayDeque {
|
||||
/* 基于环形数组实现的双向队列 */
|
||||
public class ArrayDeque {
|
||||
private readonly int[] nums; // 用于存储双向队列元素的数组
|
||||
private int front; // 队首指针,指向队首元素
|
||||
private int queSize; // 双向队列长度
|
||||
@ -112,9 +111,9 @@ namespace hello_algo.chapter_stack_and_queue {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class array_deque {
|
||||
public class array_deque {
|
||||
[Test]
|
||||
public void Test() {
|
||||
/* 初始化双向队列 */
|
||||
@ -150,5 +149,4 @@ namespace hello_algo.chapter_stack_and_queue {
|
||||
bool isEmpty = deque.isEmpty();
|
||||
Console.WriteLine("双向队列是否为空 = " + isEmpty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_stack_and_queue;
|
||||
|
||||
/* 基于环形数组实现的队列 */
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_stack_and_queue;
|
||||
|
||||
/* 基于数组实现的栈 */
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: moonache (microin1301@outlook.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_stack_and_queue;
|
||||
|
||||
public class deque {
|
||||
|
@ -4,11 +4,10 @@
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
namespace hello_algo.chapter_stack_and_queue;
|
||||
|
||||
namespace hello_algo.chapter_stack_and_queue {
|
||||
/* 双向链表节点 */
|
||||
public class ListNode {
|
||||
/* 双向链表节点 */
|
||||
public class ListNode {
|
||||
public int val; // 节点值
|
||||
public ListNode? next; // 后继节点引用(指针)
|
||||
public ListNode? prev; // 前驱节点引用(指针)
|
||||
@ -18,10 +17,10 @@ namespace hello_algo.chapter_stack_and_queue {
|
||||
prev = null;
|
||||
next = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 基于双向链表实现的双向队列 */
|
||||
public class LinkedListDeque {
|
||||
/* 基于双向链表实现的双向队列 */
|
||||
public class LinkedListDeque {
|
||||
private ListNode? front, rear; // 头节点 front, 尾节点 rear
|
||||
private int queSize = 0; // 双向队列的长度
|
||||
|
||||
@ -144,9 +143,9 @@ namespace hello_algo.chapter_stack_and_queue {
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class linkedlist_deque {
|
||||
public class linkedlist_deque {
|
||||
[Test]
|
||||
public void Test() {
|
||||
/* 初始化双向队列 */
|
||||
@ -182,5 +181,4 @@ namespace hello_algo.chapter_stack_and_queue {
|
||||
bool isEmpty = deque.isEmpty();
|
||||
Console.WriteLine("双向队列是否为空 = " + isEmpty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_stack_and_queue;
|
||||
|
||||
/* 基于链表实现的队列 */
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_stack_and_queue;
|
||||
|
||||
/* 基于链表实现的栈 */
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_stack_and_queue;
|
||||
|
||||
public class queue {
|
||||
|
@ -4,8 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_stack_and_queue;
|
||||
|
||||
public class stack {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_tree;
|
||||
|
||||
/* AVL 树 */
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_tree;
|
||||
|
||||
class BinarySearchTree {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_tree;
|
||||
|
||||
public class binary_tree {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_tree;
|
||||
|
||||
public class binary_tree_bfs {
|
||||
|
@ -4,9 +4,6 @@
|
||||
* Author: haptear (haptear@hotmail.com)
|
||||
*/
|
||||
|
||||
using hello_algo.utils;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_tree;
|
||||
|
||||
public class binary_tree_dfs {
|
||||
|
Loading…
x
Reference in New Issue
Block a user