Here you will find implementation of all sorts of data structures and algorithms in C#.
Best | Avg | Worst | Space | |
---|---|---|---|---|
Bubble Sort | O(n) | O(n^2) | O(n^2) | O(1) |
Insertion Sort | O(n) | O(n^2) | O(n^2) | O(1) |
Selection Sort | O(n^2) | O(n^2) | O(n^2) | O(1) |
Quick Sort | O(n Log(n)) | O(n Log(n)) | O(n^2) | O(n Log(n)) |
Heap Sort | O(n Log(n)) | O(n Log(n)) | O(n Log(n)) | O(1) |
Merge Sort | O(n Log(n)) | O(n Log(n)) | O(n Log(n)) | O(n) |
Time | Space | |
---|---|---|
Build Trie | O(n^2) | O(n^2) |
Lookup | O(n) | O(1) |
- DFS: Depth First Search
Time | Space | |
---|---|---|
DFS with Recursion | O(v + e) | O(v) |
DFS with Stack | O(v + e) | O(v) |
- BFS: Breadth First Search
Time | Space | |
---|---|---|
BFS with Recursion | O(v + e) | O(v) |
BFS with Queue | O(v + e) | O(v) |
Time | Space | |
---|---|---|
Shortest Path | O(v^2 + e) | O(v) |