I'm having trouble converting code fragments into equations that figure out T(n) of said equation. An example code fragment is this: a = b + c; d = a ...
I'm having trouble converting code fragments into equations that figure out T(n) of said equation. An example code fragment is this: a = b + c; d = a ...
I have a test in computer sience about complexity and I have this question: My solution is O(nlogn) because the first for is n-2 and the second for ...
Can you give the asymptotic analysis of this I have tried analysing but I was stuck at the inner loop ...
How do you calculate the cost function for this loop: Along with the cost function, what is the Big-O notation? ...
What is the space complexity of this code (it finds out how many negative numbers are in nested lists of integers)? Is it O(1) since no variables are ...
I have the following function fn(n). I understand how this code works, but don't how to calculate time complexity for it. Let’s do some examples ...
I assume that this code ideally representation of O(n^2) complexity. The reason is for function in another for function Also, I read that code belo ...
I have read many explanations of amortized analysis and how it differs from average-case analysis. However, I have not found a single explanation that ...
I am writing a component in Vue that lets us take an array of objects for a table and apply HTML formatting to the data, but the way I have it written ...
It's a slot machine game. We already know the number of different outputs. But it needs to work on any kind of variations of that table, obviously. S ...
I just learned time complexity and I'm trying to calculate the theta for this code: I though that its n*log(n), because the first loop complexity i ...
double expRecursive(double x, int n) { if (n <= 4) { return expIterativ(x, n); } return expRecursive(x, n/2) * expR ...
I wrote a program that solves maze that is not ideal (has 1 or more correct paths) using recursion DFS algorithm. I have a problem with the time compl ...
Consider the following C-Code on modern day Intel or AMD x86_64 hardware, where the datatype int has 32 bits: // calc x times y for any two integers ...
What will be the time complexity for this function, can someone explain? I am trying to find the time complexity for the given function. I think th ...
I'm trying to figure the time complexity of this function out: Pseudo-code Is the time complexity O(n^2logN)? as you can see, this example is of a ...
What is the time complexity of this code? Is the innermost loop O(1) or O(n^2)? ...
let obj1 = [{field1:11, field2:12, field3:13}, {field1:21, field2:22, field3:23}, {field1:31, field2:32, field3:33}, {field1:41, field2:42, fi ...
I want to generate a random string of a fixed length L. However, there is a set of "banned" substrings all of length b that cannot appear in the strin ...
Let's say we have a problem where a certain algorithm, let's call it algorithm_1, solves it in time complexity of O(n^2) and another algorithm, let's ...