refactor: use global using to reduce usings in each file (#486)

This commit is contained in:
hpstory 2023-05-06 22:48:02 +08:00 committed by GitHub
parent db6caf0d43
commit 40319e7f30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 311 additions and 428 deletions

View File

@ -0,0 +1,2 @@
global using NUnit.Framework;
global using hello_algo.utils;

View File

@ -2,8 +2,6 @@
// Created Time: 2022-12-14 // Created Time: 2022-12-14
// Author: mingXta (1195669834@qq.com) // Author: mingXta (1195669834@qq.com)
using NUnit.Framework;
namespace hello_algo.chapter_array_and_linkedlist; namespace hello_algo.chapter_array_and_linkedlist;
public class array { public class array {

View File

@ -2,9 +2,6 @@
// Created Time: 2022-12-16 // Created Time: 2022-12-16
// Author: mingXta (1195669834@qq.com) // Author: mingXta (1195669834@qq.com)
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_array_and_linkedlist; namespace hello_algo.chapter_array_and_linkedlist;
public class linked_list { public class linked_list {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_array_and_linkedlist; namespace hello_algo.chapter_array_and_linkedlist;
public class list { public class list {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_array_and_linkedlist; namespace hello_algo.chapter_array_and_linkedlist;
/* 列表类简易实现 */ /* 列表类简易实现 */

View File

@ -4,9 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_backtracking; namespace hello_algo.chapter_backtracking;
public class n_queens { public class n_queens {

View File

@ -4,9 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_backtracking; namespace hello_algo.chapter_backtracking;
public class permutations_i { public class permutations_i {

View File

@ -4,9 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_backtracking; namespace hello_algo.chapter_backtracking;
public class permutations_ii { public class permutations_ii {

View File

@ -4,9 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_backtracking; namespace hello_algo.chapter_backtracking;
public class preorder_traversal_i_compact { public class preorder_traversal_i_compact {

View File

@ -4,9 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_backtracking; namespace hello_algo.chapter_backtracking;
public class preorder_traversal_ii_compact { public class preorder_traversal_ii_compact {

View File

@ -4,9 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_backtracking; namespace hello_algo.chapter_backtracking;
public class preorder_traversal_iii_compact { public class preorder_traversal_iii_compact {

View File

@ -4,9 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_backtracking; namespace hello_algo.chapter_backtracking;
public class preorder_traversal_iii_template { public class preorder_traversal_iii_template {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_binary_search; namespace hello_algo.chapter_binary_search;
public class binary_search { public class binary_search {

View File

@ -4,9 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_computational_complexity; namespace hello_algo.chapter_computational_complexity;
public class space_complexity { public class space_complexity {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_computational_complexity; namespace hello_algo.chapter_computational_complexity;
public class time_complexity { public class time_complexity {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_computational_complexity; namespace hello_algo.chapter_computational_complexity;
public class worst_best_time_complexity { public class worst_best_time_complexity {

View File

@ -4,9 +4,6 @@
* Author: zjkung1123 (zjkung1123@gmail.com) * Author: zjkung1123 (zjkung1123@gmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_graph; namespace hello_algo.chapter_graph;
/* 基于邻接表实现的无向图类 */ /* 基于邻接表实现的无向图类 */

View File

@ -4,9 +4,6 @@
* Author: zjkung1123 (zjkung1123@gmail.com) * Author: zjkung1123 (zjkung1123@gmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_graph; namespace hello_algo.chapter_graph;
/* 基于邻接矩阵实现的无向图类 */ /* 基于邻接矩阵实现的无向图类 */

View File

@ -4,9 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_graph; namespace hello_algo.chapter_graph;
public class graph_bfs { public class graph_bfs {

View File

@ -4,9 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_graph; namespace hello_algo.chapter_graph;
public class graph_dfs { public class graph_dfs {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_hashing; namespace hello_algo.chapter_hashing;
/* 键值对 int->string */ /* 键值对 int->string */

View File

@ -5,9 +5,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_hashing; namespace hello_algo.chapter_hashing;
public class hash_map { public class hash_map {

View File

@ -4,9 +4,6 @@
* Author: zjkung1123 (zjkung1123@gmail.com) * Author: zjkung1123 (zjkung1123@gmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_heap; namespace hello_algo.chapter_heap;
public class heap { public class heap {

View File

@ -4,9 +4,6 @@
* Author: zjkung1123 (zjkung1123@gmail.com) * Author: zjkung1123 (zjkung1123@gmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_heap; namespace hello_algo.chapter_heap;
/* 大顶堆 */ /* 大顶堆 */

View File

@ -4,9 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_searching; namespace hello_algo.chapter_searching;
public class hashing_search { public class hashing_search {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_searching; namespace hello_algo.chapter_searching;
public class leetcode_two_sum { public class leetcode_two_sum {

View File

@ -4,9 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_searching; namespace hello_algo.chapter_searching;
public class linear_search { public class linear_search {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_sorting; namespace hello_algo.chapter_sorting;
public class bubble_sort { public class bubble_sort {

View File

@ -4,8 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_sorting; namespace hello_algo.chapter_sorting;
public class bucket_sort { public class bucket_sort {

View File

@ -4,8 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_sorting; namespace hello_algo.chapter_sorting;
public class counting_sort { public class counting_sort {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_sorting; namespace hello_algo.chapter_sorting;
public class insertion_sort { public class insertion_sort {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_sorting; namespace hello_algo.chapter_sorting;
public class merge_sort { public class merge_sort {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_sorting; namespace hello_algo.chapter_sorting;
class QuickSort { class QuickSort {

View File

@ -4,8 +4,6 @@
* Author: hpstory (hpstory1024@163.com) * Author: hpstory (hpstory1024@163.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_sorting; namespace hello_algo.chapter_sorting;
public class radix_sort { public class radix_sort {

View File

@ -4,9 +4,8 @@
* Author: hpstory (hpstory1024@163.com) * 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 readonly int[] nums; // 用于存储双向队列元素的数组
@ -151,4 +150,3 @@ namespace hello_algo.chapter_stack_and_queue {
Console.WriteLine("双向队列是否为空 = " + isEmpty); Console.WriteLine("双向队列是否为空 = " + isEmpty);
} }
} }
}

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_stack_and_queue; namespace hello_algo.chapter_stack_and_queue;
/* 基于环形数组实现的队列 */ /* 基于环形数组实现的队列 */

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_stack_and_queue; namespace hello_algo.chapter_stack_and_queue;
/* 基于数组实现的栈 */ /* 基于数组实现的栈 */

View File

@ -4,8 +4,6 @@
* Author: moonache (microin1301@outlook.com) * Author: moonache (microin1301@outlook.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_stack_and_queue; namespace hello_algo.chapter_stack_and_queue;
public class deque { public class deque {

View File

@ -4,9 +4,8 @@
* Author: hpstory (hpstory1024@163.com) * 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 int val; // 节点值
@ -183,4 +182,3 @@ namespace hello_algo.chapter_stack_and_queue {
Console.WriteLine("双向队列是否为空 = " + isEmpty); Console.WriteLine("双向队列是否为空 = " + isEmpty);
} }
} }
}

View File

@ -4,9 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_stack_and_queue; namespace hello_algo.chapter_stack_and_queue;
/* 基于链表实现的队列 */ /* 基于链表实现的队列 */

View File

@ -4,9 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_stack_and_queue; namespace hello_algo.chapter_stack_and_queue;
/* 基于链表实现的栈 */ /* 基于链表实现的栈 */

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_stack_and_queue; namespace hello_algo.chapter_stack_and_queue;
public class queue { public class queue {

View File

@ -4,8 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using NUnit.Framework;
namespace hello_algo.chapter_stack_and_queue; namespace hello_algo.chapter_stack_and_queue;
public class stack { public class stack {

View File

@ -4,9 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_tree; namespace hello_algo.chapter_tree;
/* AVL 树 */ /* AVL 树 */

View File

@ -4,9 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_tree; namespace hello_algo.chapter_tree;
class BinarySearchTree { class BinarySearchTree {

View File

@ -4,9 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_tree; namespace hello_algo.chapter_tree;
public class binary_tree { public class binary_tree {

View File

@ -4,9 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_tree; namespace hello_algo.chapter_tree;
public class binary_tree_bfs { public class binary_tree_bfs {

View File

@ -4,9 +4,6 @@
* Author: haptear (haptear@hotmail.com) * Author: haptear (haptear@hotmail.com)
*/ */
using hello_algo.utils;
using NUnit.Framework;
namespace hello_algo.chapter_tree; namespace hello_algo.chapter_tree;
public class binary_tree_dfs { public class binary_tree_dfs {