A comprehensive C# project structure for learning Data Structures and Algorithms, organized by topic with problems ranging from easy to hard.
Each problem has its own folder following the format: X.Y ProblemName_Difficulty
DSA/
├── 01_ArraysAndHashing/ (9 problems)
│ ├── 1.1 ContainsDuplicate_Easy/
│ ├── 1.2 TwoSum_Easy/
│ ├── 1.3 ProductExceptSelf_Medium/
│ └── ... (6 more problems)
├── 02_CSharpCollections/ (9 problems)
│ ├── 2.1 FindMax_Easy/
│ ├── 2.2 CharacterFrequency_Medium/
│ └── ... (7 more problems)
├── 03_TwoPointers/ (5 problems)
├── 04_StringManipulation/ (3 problems)
├── 05_BinarySearch/ (7 problems)
├── 06_SlidingWindow/ (5 problems)
├── 07_Stack/ (6 problems)
├── 08_LinkedList/ (10 problems)
├── 09_Recursion/ (3 problems)
├── 10_Trees/ (15 problems)
├── 11_Tries/ (4 problems)
├── 12_HeapPriorityQueue/ (9 problems)
├── 13_Backtracking/ (10 problems)
├── 14_Intervals/ (6 problems)
├── 15_Greedy/ (9 problems)
├── 16_Graphs/ (13 problems)
├── 17_AdvancedGraphs/ (8 problems)
├── 18_OneDimensionalDP/ (12 problems)
├── 19_TwoDimensionalDP/ (11 problems)
├── 20_BitManipulation/ (7 problems)
├── 21_MathAndGeometry/ (8 problems)
├── Program.cs (Main entry point)
├── DSA.csproj (Project file)
├── DSA.sln (Solution file)
├── DSA_Roadmap.md (Learning roadmap)
├── TESTING_GUIDE.md (How to test your solutions)
├── roadmap_visual.html (Interactive roadmap visualization)
└── README.md (This file)
- Total: 169 problems across 21 topics
- Each problem is in its own folder:
X.Y ProblemName_Difficulty - Each problem file contains:
- Problem description with examples
- Constraints
- Solution method stub with TODO
- Hints and complexity notes
Test()method with 2 test cases (ready to use!)
| Topic | Problems | Topic | Problems |
|---|---|---|---|
| 01. Arrays & Hashing | 9 | 12. Heap / Priority Queue | 9 |
| 02. C# Collections | 9 | 13. Backtracking | 10 |
| 03. Two Pointers | 5 | 14. Intervals | 6 |
| 04. String Manipulation | 3 | 15. Greedy | 9 |
| 05. Binary Search | 7 | 16. Graphs | 13 |
| 06. Sliding Window | 5 | 17. Advanced Graphs | 8 |
| 07. Stack | 6 | 18. 1-D Dynamic Programming | 12 |
| 08. Linked List | 10 | 19. 2-D Dynamic Programming | 11 |
| 09. Recursion | 3 | 20. Bit Manipulation | 7 |
| 10. Trees | 15 | 21. Math & Geometry | 8 |
| 11. Tries | 4 | Total | 169 |
- .NET 10.0 SDK or later
- Visual Studio 2022, VS Code, or any C# IDE
-
Restore dependencies:
dotnet restore
-
Build the project:
dotnet build
-
Run the program:
dotnet run
- Open a problem folder (e.g.,
01_ArraysAndHashing/1.1 ContainsDuplicate_Easy/) - Open the problem file (e.g.,
ContainsDuplicate.cs) - Read the problem description in the XML comments
- Implement the solution in the
Solutionmethod (replace TODO) - Test your solution by uncommenting the test in
Program.cs:using DSA._1_1_ContainsDuplicate_Easy; ContainsDuplicate.Test();
- Run
dotnet runto see test results with pass/fail indicators
Note: All 169 problems already have Test() methods with 2 test cases each. See TESTING_GUIDE.md for more details.
Follow the roadmap in DSA_Roadmap.md to learn topics in the recommended order:
- Arrays & Hashing
- C# Collections
- Two Pointers
- String Manipulation
- Binary Search
- Sliding Window
- Stack
- Linked List
- Recursion
- Trees
- Tries
- Heap / Priority Queue
- Backtracking
- Intervals
- Greedy
- Graphs
- Advanced Graphs
- 1-D Dynamic Programming
- 2-D Dynamic Programming
- Bit Manipulation
- Math & Geometry
- Start with Easy problems (X.1) to understand the concept
- Move to Medium (X.2) to master the pattern
- Challenge yourself with Hard (X.3) to see advanced applications
- Test edge cases: empty inputs, single elements, duplicates, null values
- Analyze time/space complexity for each solution
- Review solutions after a few days to reinforce learning
- See
DSA_Roadmap.mdfor detailed learning guide and resources - Practice on LeetCode, HackerRank, or CodeSignal
- Refer to Microsoft Docs for C# collections and language features