### How does if inside for loop change big O (time complexity) of a function?

I tried to find something similar but wasn't successful, if a question like this exists, my...

### Sorting complexity using function and without function [on hold]

Sort using JavaScript sort function is faster or sorting through loop?

### Find the longest line in 2D (MxM) array (vertical, horizontal, or diagonal)

Find the length of the longest line with given square (MxM) matrix. (vertical, horizontal, or...

### Algorithms: Exact number of executions of statement in a for loop [on hold]

I have been able to find Big-O notation for any problem, but I found a problem with this kind of...

### Log-Structured-Merge tree key lookup complexity

Im currently studying the Log-Structured-Merge tree described by O'Neil et. al. Something is not...

### Cover a given range of an array

I'm trying to figure out the algorithm to implement a method and I would need some advice in the...

### Big O complete definitions [on hold]

I want to clarify some definitions about Big O notation, because it seems that I absolutely messed...

### Asymptotic Analysis vs Big O

Let's consider the following function: int foo(int n) { int x = 0; for(int i = 0; i < n;...

### About the upper and lower bounds of T(n)

T(n) = 27T(n/3) + n^2. I just solved this question and found out the answer is Θ(n^3) by using...

### time complexity of a recursive function of a depth first walk of a graph

I am a starter in learning recursive function and time-complexity. I have this recursive...

### Time complexity for loop with limit n*n

What is the time complexity for the following loop? for(int i=0;i<(n*n);i++) ...

### How to decrease the time complexity of the following python code?

Looks like current memory complexity is O(1) and time complexity is O(k). How to keep the memory...

### Complexity of finding sequence of numbers in a matrix

The interview question was that there is a matrix with integer numbers. Find the length of the...

### What is the algorithmic complexity of converting a collections.deque to python list?

I'm trying to determine the complexity of converting a collections.deque object into a python list...

### Is it possible to search in an array with constant time complexity? [on hold]

I looked up a bit about this but I have found that if I don't know anything about what is in the...

### How to improve an algorithm to check if there is an element in the array that is equal to the difference between any other two elements in the array?

I know that this is apparently a simple question. But I can't get a better approach to get better...

### Calculating complexity of Matrix factorization

how I can calculate the time complexity of following loss function? omega indicates the set of...

### Time complexity of a function that calls other functions [closed]

Would the time complexity be the product of the time complexities of each function that is called?...

### Why is the average case time complexity same as that of the worst case in the BINARY SEARCH?

I have derived the value for the average case for binary search and also for worst case. But i am...

### Am I Oversimplifying Calculating Complexity

I'm just trying to calculate complexity on some program fragments, but I'm, worried I'm making...

### While solving some problems of time complexity, got stuck in the following code fragment [duplicate]

This question already has an answer here: How to find time complexity...

### number of swaps required in bubble sort without actually sorting it [duplicate]

This question already has an answer here: How to find number of...

### Time complexity of algorithm with multiple recursion

i'm trying to known time complexity about the following algorithms : static int g(int[] a) { ...

### Why the Time Complexity of my python code O(N**2) [closed]

I am having a tough time understanding how time complexity is calculated for a python code. Why is...

### How to calculate formally the running time of the naive polynomial evaluation at a point

I understand intuitively why the time complexity of the naive polynomial evaluation at a point is...

### Is a time complexity of O(nlogn) + O(n) just O(nlogn)?

Let's say I have an array of length n and I sorted through it using a sorting algorithm with time...

### Can we do 4-sum algorithm in O(n^2)?

this is related to the following...

### Best and the worst case time complexity for 4 nested 'for' loops?

What is the worst and the best time complexity for nested for loop? int compare(int n, int A[][])...

### About time complexity of Insertion-sort

Lecture note Here is my lecture note and i just can't figure out why when j = 2 to n, the times of...

### Runtime of recursive function

I am trying to find the runtime of this function: myst_fun_1([]) -> 0; myst_fun_1(ListUsed = [_...