Big-O Searching Complexities
average case time complexity Binary search of a Sorted array of n elements
O(log(n))
worst case time complexity Binary search of a Sorted array of n elements
O(log(n))
worst case time complexity of Linear (Brute Force) Array
O(n)
worst space complexity for a Depth First Search (DFS) Graph of |V| vertices and |E| edges
O(|V|)
worst space complexity for a Shortest path by Bellman-Ford Graph with |V| vertices and |E| edges
O(|V|)
average case time complexity for a Shortest path by Dijkstra, using an unsorted array as priority queue Graph with |V| vertices and |E| edges
O(|V|^2)
worst case time complexity for a Shortest path by Dijkstra, using an unsorted array as priority queue Graph with |V| vertices and |E| edges
O(|V|^2)
average time complexity for a Shortest path by Bellman-Ford Graph with |V| vertices and |E| edges
O(|V||E|)
worst time complexity for a Shortest path by Bellman-Ford Graph with |V| vertices and |E| edges
O(|V||E|)
worst case space complexity for a Shortest path by Dijkstra, using an unsorted array as priority queue Graph with |V| vertices and |E| edges
O(|V|)
worst case space complexity of Shortest path by Dijkstra, using a Min-heap as priority queue Graph with |V| vertices and |E| edges
O(|V|)
worst space complexity for Breadth First Search (BFS) Graph of |V| vertices and |E| edges
O(|V|)
worst case space complexity Binary search of a Sorted array of n elements
O(1)
average case time complexity of Linear (Brute Force) Array
O(n)
average time complexity for Shortest path by Dijkstra, using a Min-heap as priority queue Graph with |V| vertices and |E| edges
O((|V| + |E|) log |V|)
worst case time complexity of Shortest path by Dijkstra, using a Min-heap as priority queue Graph with |V| vertices and |E| edges
O((|V| + |E|) log |V|)
worst case space complexity of Linear (Brute Force) Array
O(1)
Worst case time complexity of Breadth First Search (BFS) of a Graph of |V| vertices and |E| edges
Worst O(|E| + |V|)
Worst case time complexity of Depth First Search (DFS) of a Graph of |V| vertices and |E| edges
Worst O(|E| + |V|)