Welcome To Tutorialspoint.dev
Officially launched 18th May 2019

# What does ‘Space Complexity’ mean?

Space Complexity: The term Space Complexity is misused for Auxiliary Space at many places. Following are the correct definitions of Auxiliary Space and Space Complexi...

# A Time Complexity Question

What is the time complexity of following function fun()? Assume that log(x) returns log value in base 2. void fun() { &#xA0;&#xA0;&#xA0;int i, j; &#xA0;&...

# Time Complexity of building a heap

Consider the following algorithm for building a Heap of an input array A. BUILD-HEAP(A) heapsize := size(A); for i := floor(heapsize/2) downto 1 ...

# Time Complexity where loop variable is incremented by 1, 2, 3, 4 ..

What is the time complexity of below code? void fun(int n) { &#xA0;&#xA0;&#xA0;int j = 1, i = 0; &#xA0;&#xA0;&#xA0;while (i &lt; n) &#xA0;&#xA0;&#xA0;{ ...

# Time Complexity of Loop with Powers

What is the time complexity of below function? void fun(int n, int k) { &#xA0;&#xA0;&#xA0;&#xA0;for (int i=1; i&lt;=n; i++) &#xA0;&#xA0;&#xA0;&#xA0;{ &#x...

# Sieve of Eratosthenes in 0(n) time complexity

The classical Sieve of Eratosthenes algorithm takes O(N log (log N)) time to find all prime numbers less than N. In this article, a modified Sieve is discussed that w...

# An Insertion Sort time complexity question

Question : How much time Insertion sort takes to sort an array of size n in below form? arr[] = 2, 1, 4, 3, 6, 5,&#x2026;.i, i-1, &#x2026;..n, n-1 Answer : At first ...

# Time complexity of insertion sort when there are O(n) inversions?

What is an inversion? Given an array arr[], a pair arr[i] and arr[j] forms an inversion if arr[i] &lt; arr[j] and i &gt; j. For example, the array {1, 3, 2, 5} has on...

# Can QuickSort be implemented in O(nLogn) worst case time complexity?

The worst case time complexity of a typical implementation of QuickSort is O(n2). The worst case occurs when the picked pivot is always an extreme (smallest or larges...

# Time Complexity of building a heap

Consider the following algorithm for building a Heap of an input array A. BUILD-HEAP(A) heapsize := size(A); for i := floor(heapsize/2) downto 1 ...