A collection of classic data structures and algorithm implementations in C#, written from scratch without relying on built-in collection classes.
Benchmarking tool that measures and compares the performance of two O(n²) sorting algorithms across three input scenarios.
Algorithms:
- Insertion Sort — O(n²) average, O(n) best case. Shifts each element into its correct position in the sorted prefix.
- Shaker Sort — O(n²) average, O(n) best case. Bidirectional bubble sort with early-exit optimization.
Test scenarios per algorithm:
| Scenario | Description |
|---|---|
| Random | Array of random integers |
| Already sorted | Best case — tests early-exit behavior |
| Reverse sorted | Worst case |
Array sizes: 1,000 / 100,000 / 1,000,000 elements (user selects on startup).
Timing is measured with System.Diagnostics.Stopwatch at nanosecond precision.
A generic singly linked list (CustomLinkedList<T>) implemented from scratch with 14 interactive operations via a console menu.
Supported operations:
| # | Operation |
|---|---|
| 1 | Print all elements |
| 2 | Print in reverse order |
| 3 | Count elements |
| 4 | Insert at beginning |
| 5 | Remove last element |
| 6 | Clear list |
| 7 | Insert after i-th element |
| 8 | Insert before i-th element |
| 9 | Append to end |
| 10 | Append same value k times |
| 11 | Build list from range [a, b] |
| 12 | Remove every k-th element |
| 13 | Remove last k elements |
| 14 | Remove element at index i |
Key implementation details:
- Generic
Node<T>andCustomLinkedList<T>— noSystem.Collections.Generic.LinkedListused - Manual pointer manipulation for all insert/remove operations
FindPrevNode()helper for reverse traversal and node removal- Static
Range(a, b)factory method
C# · .NET · System.Diagnostics.Stopwatch
Open in Visual Studio or run with .NET CLI:
# Sorting benchmark
dotnet run --project SortingBenchmark.cs
# Linked list demo
dotnet run --project LinkedListDemo.csOr create a new Console App project in Visual Studio and replace Program.cs with either file.
University coursework projects. Written to demonstrate understanding of fundamental data structures, algorithm complexity, and manual memory/pointer management in C#.