How do you easily measure the time complexity of an algorithm? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How do you easily measure the time complexity of an algorithm?

Hey guys! I am trying to figure out if this code is correct and how can I measure the time complexity of it, please check, give me your feedback and answer my question: https://code.sololearn.com/cZE4E1iWG0Tb/#py P.D: I am studying that subject, please also help with a good page with information about and how can I measure it without going counting line per line with differents inputs. If you like the code, please upvote. Otherwise, tell me what can I improve.

31st May 2019, 6:10 AM
Rosana Rodrƭguez MilanƩs
Rosana Rodrƭguez MilanƩs - avatar
3 Respostas
+ 3
Rosana RodrĆ­guez MilanĆ©s hi, šŸŽ I'll give you the most basic information and assign one unit to every statement and at last summation of all statement units an basic complexity is calculated which is space complexity šŸŽ if any loop is their in any statement then assign that loop with the number of times that loop is executing like if an loop is going to n time to run then you can assign them with n unit šŸŽ then if their any nested loop then that inner loop with n unit and outer loop with n unit and if nested loop is their then assign n*n to the statement šŸŽ if function are their then assign function with the statement that are present in that function if that has 5 statements then assign 5 to that function and the time that which the function is calling Have these šŸŽ šŸŽ šŸŽ šŸŽ šŸŽ
31st May 2019, 6:28 AM
DishaAhuja
DishaAhuja - avatar
+ 4
šŸŽ complexity can be calculated in three notation like šŸŽ BigOh(O) notation šŸŽ Theta(Ī¦) notation šŸŽ omega(Ī ) notation Every notation is calculated and defined according to worst case and the best case and average case complexity šŸŽ this link will help about calculate complexity https://www.hackerearth.com/practice/basic-programming/complexity-analysis/time-and-space-complexity/tutorial/ šŸŽ https://medium.com/@.RT/total-n00bs-guide-to-big-o-big-%CF%89-big-%CE%B8-aa259ae8a1c2
31st May 2019, 6:32 AM
DishaAhuja
DishaAhuja - avatar
+ 3
Here is an lesson about that which is quite good explanation https://www.sololearn.com/learn/6362/?ref=app If you have any further query ping me I'll loved to answer with some example https://www.sololearn.com/learn/6362/?ref=app Have these šŸŽ šŸŽ šŸŽ šŸŽ
31st May 2019, 6:34 AM
DishaAhuja
DishaAhuja - avatar