Algorithm | Best case | Average case | Worst case |
Binary Search | O(1) | O(Log2 N) | O(log(n)) |
Sequential Search | O(1) | O(n/2) | O(n) |
Quick Sort | O(N log N) | O(N2) | |
Merge Sort | O(N log N) | ||
Insertion Sort | O(n) | O(N2) | |
Bubble Sort | O(N2) | ||
Heap Sort | O(N log N) | ||
Selection sort | O(N2) | ||
Height of CBT (Complete Binary Tree) | O(log N) | ||
Insertion in Heap | O(log N) | ||
To construct a heap | N log N | ||
Delete from heap | Log2N | ||
Huffman’s | N log N | ||
Prim’s algorithm | O(N2) Note: if we are using the matrix for | O[(V+E)logV] If we are using heap | |
Kruskal’s Algorithm | O(ElogE) | ||
Depth First Search | O(V+E) | ||
Breadth-First Search | |||
All pairs shortest path | O(N3) | ||
Dijkstra’s algorithm | O(V2) |
Comments
Post a Comment