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.

Detecting if a string has unique characters: comparing my solution to "Cracking the Coding Interview?"

I am working through the book "Cracking the Coding Interview" and I have come across questions here asking for answers, …

java string algorithm big-o time-complexity
Time complexity of Java's substring()

What is the time complexity of the String#substring() method in Java?

java substring time-complexity
What is the time complexity of HashMap.containsKey() in java?

I need to know: What is the time complexity of HashMap.containsKey() in java?

java performance hashmap time-complexity
LRU cache in Java with Generics and O(1) operations

This is a question that comes up a lot in job interviews. The idea is to define a data structure …

java generics data-structures time-complexity
Is complexity O(log(n)) equivalent to O(sqrt(n))?

My professor just taught us that any operation that halves the length of the input has an O(log(n)) …

algorithm time-complexity
Time Complexity of the Kruskal Algorithm?

I am calculating time complexity for kruskal algorithm like this (Please see the algorithm in the Image Attached) T(n) = …

algorithm time-complexity graph-algorithm asymptotic-complexity kruskals-algorithm
Time Complexity of Prims Algorithm?

I found the time complexity of Prims algorithm everywhere as O((V + E) log V) = E log V. But as …

time-complexity prims-algorithm
When will the worst case of Merge Sort occur?

I know that worst case on mergesort is O(nlogn), the same as the average case. However, if the data …

arrays algorithm sorting complexity-theory time-complexity
Time complexity of depth-first graph algorithm

I am starting to learn time complexity, and I looked in the examples for the time complexity for some simple …

algorithm time-complexity depth-first-search
Complexity of *in* operator in Python

What is the complexity of the in operator in Python? Is it theta(n)? Is it the same as the …

python time-complexity