Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions DataStructures/AATree/AATree.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.AATree;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/AVLTree/AVLTree.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.AVLTree;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/AVLTree/AVLTreeNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace DataStructures.AVLTree;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/BinarySearchTree/BinarySearchTree.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.BinarySearchTree;

/// <summary>
Expand Down
4 changes: 0 additions & 4 deletions DataStructures/BitArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@
// returns true if there inputs aren't equal otherwise false.
// assumes: the input bit-arrays must have same length.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataStructures;

Expand Down
2 changes: 0 additions & 2 deletions DataStructures/Cache/LfuCache.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections.Generic;

namespace DataStructures.Cache;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/Cache/LruCache.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections.Generic;

namespace DataStructures.Cache;

/// <summary>
Expand Down
16 changes: 16 additions & 0 deletions DataStructures/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// -----------------------------------------------------------------------------
// Global using directives for the C-Sharp solution.
// These namespaces are imported globally so they don’t need to be repeatedly declared
// in individual files, improving readability and reducing boilerplate.
//
// Guidelines:
// - Keep only the most commonly used namespaces here.
// - Add project-specific namespaces (e.g., Utilities.Extensions) only if they are
// required across the majority of files in the project.
// - Avoid placing rarely used namespaces here to maintain clarity.
// -----------------------------------------------------------------------------

global using System; // Core base classes and fundamental types
global using System.Collections.Generic; // Generic collection types (List, Dictionary, etc.)
global using System.Linq; // LINQ query operators for collections
global using System.Text; // Text encoding, StringBuilder, etc.
3 changes: 0 additions & 3 deletions DataStructures/Graph/DirectedWeightedGraph.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.Graph;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/Graph/IDirectedWeightedGraph.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections.Generic;

namespace DataStructures.Graph;

public interface IDirectedWeightedGraph<T>
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/Hashing/HashTable.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DataStructures.Hashing.NumberTheory;

namespace DataStructures.Hashing;
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/Heap/BinaryHeap.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.Heap;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/Heap/FibonacciHeap/FHeapNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace DataStructures.Heap.FibonacciHeap;

/// <summary>
Expand Down
4 changes: 0 additions & 4 deletions DataStructures/Heap/FibonacciHeap/FibonacciHeap.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace DataStructures.Heap.FibonacciHeap;

/// <summary>
Expand Down
4 changes: 0 additions & 4 deletions DataStructures/Heap/MinMaxHeap.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace DataStructures.Heap;

/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions DataStructures/Heap/PairingHeap/PairingHeap.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace DataStructures.Heap.PairingHeap;

Expand Down Expand Up @@ -57,7 +54,7 @@ public T Extract()
/// </summary>
public void UpdateKey(T currentValue, T newValue)
{
if(!mapping.ContainsKey(currentValue))
if (!mapping.ContainsKey(currentValue))
{
throw new ArgumentException("Current value is not present in this heap.");
}
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/Heap/PairingHeap/PairingNodeComparer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.Heap.PairingHeap;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/InvertedIndex.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System.Collections.Generic;
using System.Linq;

namespace DataStructures;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace DataStructures.LinkedList.CircularLinkedList
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using Utilities.Exceptions;

namespace DataStructures.LinkedList.DoublyLinkedList;
Expand Down
11 changes: 4 additions & 7 deletions DataStructures/LinkedList/SinglyLinkedList/SinglyLinkedList.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.LinkedList.SinglyLinkedList;

public class SinglyLinkedList<T>
Expand Down Expand Up @@ -161,7 +158,7 @@ public bool DeleteElement(T element)
public bool DeleteFirst()
{
// checks if the List is empty
if(Head is null)
if (Head is null)
{
return false;
}
Expand All @@ -178,21 +175,21 @@ public bool DeleteFirst()
public bool DeleteLast()
{
// checks if the List is empty
if(Head is null)
if (Head is null)
{
return false;
}

// checks if the List has only one element
if(Head.Next is null)
if (Head.Next is null)
{
Head = null;
return true;
}

// if not, iterates through the list to the second last element and deletes the last one
SinglyLinkedListNode<T>? secondlast = Head;
while(secondlast.Next?.Next is not null)
while (secondlast.Next?.Next is not null)
{
secondlast = secondlast.Next;
}
Expand Down
7 changes: 2 additions & 5 deletions DataStructures/LinkedList/SkipList/SkipList.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace DataStructures.LinkedList.SkipList;

Expand Down Expand Up @@ -49,7 +46,7 @@ public SkipList(int capacity = 255)
head = new(int.MinValue, default(TValue), maxLevels);
tail = new(int.MaxValue, default(TValue), maxLevels);

for(int i = 0; i < maxLevels; i++)
for (int i = 0; i < maxLevels; i++)
{
head.Next[i] = tail;
}
Expand All @@ -69,7 +66,7 @@ public TValue this[int key]
get
{
var previousNode = GetSkipNodes(key).First();
if(previousNode.Next[0].Key == key)
if (previousNode.Next[0].Key == key)
{
return previousNode.Next[0].Value!;
}
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/Probabilistic/BloomFilter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.Probabilistic;

public class BloomFilter<T> where T : notnull
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/Probabilistic/CountMinSketch.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace DataStructures.Probabilistic;

public class CountMinSketch<T> where T : notnull
Expand Down
4 changes: 0 additions & 4 deletions DataStructures/Probabilistic/HyperLogLog.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace DataStructures.Probabilistic;

public class HyperLogLog<T> where T : notnull
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/Queue/ArrayBasedQueue.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace DataStructures.Queue;

/// <summary>
Expand Down
4 changes: 0 additions & 4 deletions DataStructures/Queue/ListBasedQueue.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace DataStructures.Queue;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/Queue/StackBasedQueue.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.Queue;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/RedBlackTree/RedBlackTree.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.RedBlackTree;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/ScapegoatTree/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.ScapegoatTree;

public static class Extensions
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/ScapegoatTree/Node.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace DataStructures.ScapegoatTree;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/ScapegoatTree/ScapegoatTree.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.ScapegoatTree;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/SegmentTrees/SegmentTree.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace DataStructures.SegmentTrees;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/SegmentTrees/SegmentTreeApply.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace DataStructures.SegmentTrees;

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion DataStructures/SortedList.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;

namespace DataStructures;

Expand Down
2 changes: 0 additions & 2 deletions DataStructures/Stack/ArrayBasedStack.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace DataStructures.Stack;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/Stack/ListBasedStack.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.Stack;

/// <summary>
Expand Down
6 changes: 0 additions & 6 deletions DataStructures/Stack/QueueBasedStack.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataStructures.Stack;

public class QueueBasedStack<T>
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/Timeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ this data structure can be used to represent an ordered series of dates or times
330: Constantine move the capital to Constantinople.
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace DataStructures;

Expand Down
7 changes: 2 additions & 5 deletions DataStructures/Tries/Trie.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.Tries;

/// <summary>
Expand Down Expand Up @@ -70,10 +67,10 @@ public void Remove(string s)
s += Mark;
int index = 0;
TrieNode match = PrefixQuery(s, ref index);
while(match.IsLeaf())
while (match.IsLeaf())
{
char c = match.Value;
if(match.Parent == null)
if (match.Parent == null)
{
break;
}
Expand Down
3 changes: 0 additions & 3 deletions DataStructures/Tries/TrieNode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace DataStructures.Tries;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/UnrolledList/UnrolledLinkedList.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections.Generic;

namespace DataStructures.UnrolledList;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions DataStructures/UnrolledList/UnrolledLinkedListNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace DataStructures.UnrolledList;

/// <summary>
Expand Down