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.

How to determine memory and time complexity of an algorithm?

I am not good at determining time and memory complexities and would appreciate it if someone could help me out. …

algorithm time-complexity space-complexity
Time complexity of adjacency list representation?

I am going through this link for adjacency list representation. http://www.geeksforgeeks.org/graph-and-its-representations/ I have a simple doubt …

algorithm time-complexity breadth-first-search adjacency-list
How to improve performance of this code?

Thanks to some help from people here, I was able to get my code for Tasmanian camels puzzle working. However, …

python performance optimization time-complexity
Which is faster C++ String length() or size()?

length() returns the number of characters in the string and size() returns a size_t which is also the same …

c++ string size time-complexity string-length
What's the time complexity of array.splice() in Google Chrome?

If I remove one element from an array using splice() like so: arr.splice(i, 1); Will this be O(n) …

javascript google-chrome big-o time-complexity v8
Are there any cases where you would prefer a higher big-O time complexity algorithm over the lower one?

Are there are any cases where you would prefer O(log n) time complexity to O(1) time complexity? Or O(…

algorithm big-o time-complexity
Binary search vs binary search tree

What is the benefit of a binary search tree over a sorted array with binary search? Just with mathematical analysis …

arrays algorithm data-structures binary-tree time-complexity
Best case time complexity for selection sort

Why is the best case time complexity for selection sort O(n^2) when it is O(n) for insertion sort …

algorithm time-complexity selection-sort
Using BFS or DFS to determine the connectivity in a non connected graph?

How can i design an algorithm using BFS or DFS algorithms in order to determine the connected components of a …

algorithm time-complexity graph-algorithm pseudocode
What is the complexity of this simple piece of code?

I'm pasting this text from an ebook I have. It says the complexity if O(n2) and also gives an …

java complexity-theory big-o time-complexity stringbuffer