/DSA

Here you will find implementation of all sorts of data structures and algorithms in C#. I come back and improve my code again and again. Feel free to fork and collaborate.

Primary LanguageC#MIT LicenseMIT

DSA

Here you will find implementation of all sorts of data structures and algorithms in C#.

Sorting

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)

Trie

Time Space
Build Trie O(n^2) O(n^2)
Lookup O(n) O(1)

Graph || v = vertices, e = edges in graph

Graph Traversal Algorithms

  1. DFS: Depth First Search
Time Space
DFS with Recursion O(v + e) O(v)
DFS with Stack O(v + e) O(v)
  1. BFS: Breadth First Search
Time Space
BFS with Recursion O(v + e) O(v)
BFS with Queue O(v + e) O(v)

Dijkstra’s Shortest Path Algorithm

Time Space
Shortest Path O(v^2 + e) O(v)