Professional Documents
Culture Documents
DS Complexities
DS Complexities
1. Bubble Sort:
2. Selection Sort:
3. Insertion Sort:
4. Comb Sort:
Time Complexity: Best - O(n log n), Average - O(n^2), Worst - O(n^2)
5. Quick Sort:
Time Complexity: Best - O(n log n), Average - O(n log n), Worst - O(n^2)
6. Merge Sort:
Time Complexity: Best - O(n log n), Average - O(n log n), Worst - O(n log n)
7. Radix Sort:
8. Heap Sort:
Time Complexity: Best - O(n log n), Average - O(n log n), Worst - O(n log n)
9. Radix Sort:
Time Complexity: Best - O(n log n), Average - O(n^2), Worst - O(n^2)
Data Structures:
1. Hash Table:
2. Heaps:
3. Hashing:
4. Hashmaps:
Time Complexity (average): Best - O(log n), Average - O(log n), Worst - O(n)
6. AVL Tree:
Time Complexity (search, insert, delete): Best - O(log n), Average - O(log n), Worst -
O(log n)
7. Linked List:
10. Stacks:
Time Complexity (push, pop): Best - O(1), Average - O(1), Worst - O(1)
11. Queue:
Time Complexity (enqueue, dequeue): Best - O(1), Average - O(1), Worst - O(1)
Time Complexity (enqueue, dequeue): Best - O(1), Average - O(log n), Worst - O(log n)
Graph Algorithms:
1. Prim's Algorithm:
Time Complexity: Best - O(E + V log V), Average - O(E + V log V), Worst - O(E + V log V)
2. Kruskal's Algorithm:
Time Complexity: Best - O(E log V), Average - O(E log V), Worst - O(E log V)
3. Dijkstra's Algorithm:
Time Complexity: Best - O((V + E) log V), Average - O((V + E) log V), Worst - O((V + E) log
V)
Time Complexity: Best - O(|V| + |E|), Average - O(|V| + |E|), Worst - O(|V| + |E|)
Time Complexity: Best - O(|V| + |E|), Average - O(|V| + |E|), Worst - O(|V| + |E|)
Time Complexity: Best - O(|V| * |E|), Average - O(|V| * |E|), Worst - O(|V| * |E|)
7. Topological Sort:
Time Complexity: Best - O(|V| + |E|), Average - O(|V| + |E|), Worst - O(|V| + |E|)
Search Algorithms:
1. Binary Search:
2. Linear Search:
3. Interpolation Search:
Time Complexity: Best - O(1), Average - O(log log n), Worst - O(n)
4. Rabin-Karp Algorithm:
Time Complexity: Best - O(n + m), Average - O(n + m), Worst - O(nm)
Space Complexity: O(h), where h is the height of the tree (recursive call stack space)
2. Preorder Traversal:
Space Complexity: O(h), where h is the height of the tree (recursive call stack space)
3. Postorder Traversal:
Space Complexity: O(h), where h is the height of the tree (recursive call stack space)
Time Complexity: Best - O(V + E), Average - O(V + E), Worst - O(V + E)
2. Tarjan's Algorithm:
Time Complexity: Best - O(V + E), Average - O(V + E), Worst - O(V + E)