Data Structure

  1. Generic Linked List Code

  2. Sorting Algorithms Code

Sorting AlgoTime ComplexitySpace Complexity
Bubble SortO(n^2)O(1)
Selection SortO(n^2)O(1)
Insertion SortO(n^2)O(1)
Merge SortO(n log n)O(n)
Quick SortO(n log n) average, O(n^2) worst case (unbalanced partitions)O(log n) average, O(n) worst case
Heap SortO(n log n)O(1)
Radix SortO(nk), where k is the number of digitsO(n + k)
Counting SortO(n + k), where k is the range of input valuesO(k)
Bucket SortO(n + k), where k is the number of bucketsO(n + k)
Shell SortDepends on the gap sequence; worst-case is generally considered to be O(n^2)O(1)