StructForge 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package StructForge --version 1.1.0
                    
NuGet\Install-Package StructForge -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StructForge" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StructForge" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="StructForge" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add StructForge --version 1.1.0
                    
#r "nuget: StructForge, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package StructForge@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=StructForge&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=StructForge&version=1.1.0
                    
Install as a Cake Tool

StructForge

NuGet License: MIT

StructForge is a lightweight, educational, and practical C# library for learning and experimenting with fundamental data structures and algorithms. It provides a range of generic collections, sorting algorithms, and interfaces for building your own high-level structures.


Features

Collections

  • Lists: SfList<T>, SfLinkedList<T>
  • Stacks & Queues: SfStack<T>, SfQueue<T>
  • Heaps & Priority Queues: SfBinaryHeap<T>, SfMaxHeap<T>, SfMinHeap<T>, SfPriorityQueue<TItem, TPriority>
  • Binary Search Trees: SfBinarySearchTree<T>
  • Trees: SfBinarySearchTree<T>, SfAvlTree<T>
  • Sets & Dictionaries: SfSortedSet<T>, SfSortedDictionary<TKey, TValue>

Sorting Algorithms

  • QuickSort
  • TreeSort

Interfaces

  • ISfDataStructure<T>: Base interface for all collections
  • ISfList<T>: List interface
  • ISfLinkedList<T>: Doubly-linked list interface
  • ISfStack<T>: Stack interface
  • ISfQueue<T>: Queue interface
  • ISfHeap<T>: Generic heap interface
  • ISfTree<T>: Tree interface
  • ISfDictionary<T>: Dictionary interface

Algorithms & Utilities

  • Sorting

SfSorting.QuickSort(...)

SfSorting.TreeSort(...)

SfSorting.HeapSort(...)

  • Searching

SfAlgorithms.BinarySearch(...)

  • Randomization

SfAlgorithms.Shuffle(...)

  • Comparers

SfComparers<T> – default comparer access

SfComparerUtils – helper utilities for key/value and custom comparers

Key Capabilities

  • Fully generic implementations
  • Iteration and enumeration support
  • Custom comparers for heaps, priority queues, and sorting
  • Educational and practical reference for learning C# data structures

Installation

You can install the latest version via NuGet:

dotnet add package StructForge

Or clone the repository and include the StructForge project in your solution:

git clone https://github.com/FurkanKirat/StructForge.git

Usage Examples

Sorted Dictionary

var dict = new SfSortedDictionary<string, int>();
dict.Add("apple", 3);
dict.Add("banana", 1);
dict.Add("cherry", 2);

foreach (var kv in dict)
Console.WriteLine($"{kv.Key}: {kv.Value}");
// Output:
// banana: 1
// cherry: 2
// apple: 3
int[] data = { 1, 2, 3, 4, 5, 6 };
SfShuffleExtensions.Shuffle(data);
int index = SfSearching.BinarySearch(data, 4);

AVL Tree

var avl = new SfAvlTree<int>();
avl.Add(10);
avl.Add(5);
avl.Add(15);
avl.Add(7);

Console.WriteLine($"Min: {avl.Min}, Max: {avl.Max}, Count: {avl.Count}");

Linked List

var list = new SfLinkedList<int>();
list.AddLast(1);
list.AddLast(2);
list.AddFirst(0);

foreach (var item in list)
    Console.WriteLine(item); // 0, 1, 2

Priority Queue

var pq = new SfPriorityQueue<string, int>();
pq.Enqueue("low", 5);
pq.Enqueue("high", 1);
pq.Enqueue("medium", 3);

foreach (var item in pq.EnumerateByPriority())
    Console.WriteLine(item); // "high", "medium", "low"

QuickSort

int[] arr = { 5, 2, 9, 1, 5, 6 };
SfSorting.Quicksort(arr);
Console.WriteLine(string.Join(", ", arr)); // 1, 2, 5, 5, 6, 9

Contribution

Contributions are welcome! Feel free to open issues, add features, or improve existing code. Keep in mind that this library is primarily educational.

📦 Installation

You can install the latest version via NuGet:

dotnet add package StructForge

---

## License

MIT License – see [LICENSE](LICENSE) for details.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.0 278 12/18/2025
1.4.0 179 12/5/2025
1.3.2 682 12/2/2025
1.3.1 422 12/1/2025
1.3.0 428 12/1/2025
1.2.0 190 11/27/2025
1.1.1 291 11/13/2025
1.1.0 139 10/31/2025
1.0.0 133 10/10/2025

Initial release v1.0