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.

What exactly does O(n) space complexity mean and how inefficient is it?

I have a high level understanding of what O(n) means in space. It means something along the lines of …

algorithm sorting data-structures time-complexity space-complexity
given a set of n integers, return all subsets of k elements that sum to 0

given a unsorted set of n integers, return all subsets of size k (i.e. each set has k unique …

java time-complexity subset-sum
Print all unique combination of factors of a given number

What is the most efficient algorithm to print all unique combinations of factors of a positive integer. For example if …

java algorithm recursion time-complexity factors
Big O complexity to merge two lists

Given 2 singly linked lists already sorted, merge the lists. Example: list1: 1 2 3 5 7 list2: 0 4 6 7 10 ---> 0 1 2 3 4 5 6 7 7 10 Despite from the fact that the …

algorithm merge time-complexity singly-linked-list
Big O complexities of algorithms - LZW and Huffman

What are the space and time complexities, in Big O notation, for the Lempel-Ziv-Welch and Huffman compression algorithms? Google is …

algorithm compression big-o time-complexity space-complexity
What is fixed-parameter tractability? Why is it useful?

Some problems that are NP-hard are also fixed-parameter tractable, or FPT. Wikipedia describes a problem as fixed-parameter tractable if there's …

algorithm big-o time-complexity np
Sorting in Computer Science vs. sorting in the 'real' world

I was thinking about sorting algorithms in software, and possible ways one could surmount the O(nlogn) roadblock. I don't …

algorithm sorting time-complexity
Time complexity of Prim's MST Algorithm

Can someone explain to me why is Prim's Algorithm using adjacent matrix result in a time complexity of O(V2)?

algorithm graph time-complexity minimum-spanning-tree prims-algorithm
python shuffle algorithm performance

I was wondering about the time complexity of the shuffle function in the random Python library/module. Is it O(…

python performance time-complexity shuffle
Quickselect time complexity explained

From https://en.wikipedia.org/wiki/Quickselect it says "However, instead of recursing into both sides, as in quicksort, quickselect …

algorithm time-complexity quickselect