python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Time complexity of calculating the final digit sum of a number
I want to calculate the time complexity of calculating the "final" digit sum of a number n: sum of the digits until I get A single digit number.
I know that in the first iteration an algorit...
Daniel
Votes: 0
Answers: 1
Can you implement Binary Search Tree in Haskell with O(log n) insertion?
If I understand correctly, modifying (insertion or deletion) a Binary Search Tree in Haskell requires copying the whole tree, so practically making it being O(n). Is there a way to implement it in O(l...
Slaus
Votes: 0
Answers: 1
What is the complexity of this function in terms of n?
f(n):
s = 1
m = n
while m >= 1:
for j in 1,2,3, .., m:
s = s + 1
m = m / 2
My attempt
How many times does the statement s = s + 1 run? Well, let's try a number or...
NoName123
Votes: 0
Answers: 1
Computational complexity and recursion - Is this analysis correct?
Hi! I have a doubt about this resolution of this algorithm analysis, specifically referred to the return min(L[i:j+1]): why is it considered O(n)?: it always refers to a defined slice, with a limited...
Himan
Votes: 0
Answers: 1