Top "Time-complexity" questions

The time complexity of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the size of the input to the problem.

Why is the time complexity of both DFS and BFS O( V + E )

The basic algorithm for BFS: set start vertex to visited load it into queue while queue not empty for each …

algorithm time-complexity graph-theory breadth-first-search
Hash table runtime complexity (insert, search and delete)

Why do I keep seeing different runtime complexities for these functions on a hash table? On wiki, search and delete …

algorithm data-structures hash time-complexity hashtable
Is a Java hashmap search really O(1)?

I've seen some interesting claims on SO re Java hashmaps and their O(1) lookup time. Can someone explain why this …

java hashmap big-o time-complexity
matrix multiplication algorithm time complexity

I came up with this algorithm for matrix multiplication. I read somewhere that matrix multiplication has a time complexity of …

algorithm time-complexity matrix-multiplication
What are the time complexities of various data structures?

I am trying to list time complexities of operations of common data structures like Arrays, Binary Search Tree, Heap, Linked …

java data-structures time-complexity
Time complexity of nested for-loop

I need to calculate the time complexity of the following code: for (i = 1; i <= n; i++) { for(j = 1; j &…

big-o complexity-theory time-complexity
Complexities of binary tree traversals

What is the time complexity of inorder,postorder and preorder traversal of binary trees in data structures?? Is it O(…

time-complexity
Time complexity of Euclid's Algorithm

I am having difficulty deciding what the time complexity of Euclid's greatest common denominator algorithm is. This algorithm in pseudo-code …

algorithm big-o time-complexity iteration
Find common substring between two strings

I'd like to compare 2 strings and keep the matched, splitting off where the comparison fails. So if I have 2 strings …

python string algorithm time-complexity dynamic-programming
Explanation of runtimes of BFS and DFS

Why are the running times of BFS and DFS O(V+E), especially when there is a node that has …

data-structures graph time-complexity depth-first-search breadth-first-search